int flags const std string help text const std string icon tdebug enter menu description menu description tdebug trace verb verb icon icon my flags flags my verb verb my menu text menu text my help text help text my icon icon helptext tdebug_enter menudescription menudescription tdebug_trace myflags myverb mymenutext menutext myhelptext helptext myicon menu description menu description menudescription menudescription int menu description get flags const return my flags menudescription getflags myflags std string menu description get verb const return my verb menudescription getverb myverb std string menu description get menu text const return my menu text menudescription getmenutext mymenutext std string menu description get help text const return my help text menudescription gethelptext myhelptext std string menu description get icon const return my icon menudescription geticon myicon int menu description get index const return my index menudescription getindex myindex void menu description set index int index my index index menudescription setindex myindex void menu description perform const std vector std string files hwnd hwnd launch tortoise act false get verb files 0 hwnd menudescription launchtortoiseact getverb bool ext list ctrl is checked int index if listview getcheckstate get hwnd index return true else return false extlistctrl ischecked listview_getcheckstate gethwnd bool ext list ctrl is selected int index if get item state index wxlist state selected wxlist state selected return true else return false extlistctrl isselected getitemstate wxlist_state_selected wxlist_state_selected void ext list ctrl set checkboxes bool enable dword dw style listview getextendedlistviewstyle get hwnd if enable dw style lvs ex checkboxes else dw style lvs ex checkboxes listview setextendedlistviewstyle get hwnd dw style my has check boxes enable extlistctrl setcheckboxes dwstyle listview_getextendedlistviewstyle gethwnd dwstyle lvs_ex_checkboxes dwstyle lvs_ex_checkboxes listview_setextendedlistviewstyle gethwnd dwstyle myhascheckboxes void ext list ctrl set checked int index bool check listview setcheckstate get hwnd index check extlistctrl setchecked listview_setcheckstate gethwnd void ext list ctrl set best column width int index int w1 w2 set column width index wxlist autosize useheader w1 get column width index set column width index wxlist autosize w2 get column width index if w1 w2 set column width index w1 extlistctrl setbestcolumnwidth setcolumnwidth wxlist_autosize_useheader getcolumnwidth setcolumnwidth wxlist_autosize getcolumnwidth setcolumnwidth void ext list ctrl show focus rect if get item count 0 set item state 0 wxlist state focused wxlist state focused extlistctrl showfocusrect getitemcount setitemstate wxlist_state_focused wxlist_state_focused wx menu title c str m hwnd null m oldwndproc null m pcontextmenu2 null wxmenu c_str m_hwnd m_oldwndproc m_pcontextmenu2 explorer menu explorer menu remove instance from map explorermenu map erase m hwnd install old window proc if m oldwndproc set window long ptr m hwnd gwlp wndproc long ptr m oldwndproc release interface pointer if m pcontextmenu2 m pcontextmenu2 release explorermenu explorermenu explorermenu_map m_hwnd m_oldwndproc setwindowlongptr m_hwnd gwlp_wndproc long_ptr m_oldwndproc m_pcontextmenu2 m_pcontextmenu2 const std vector std string files m hwnd hwnd add instance to map explorermenu map m hwnd this add new window proc m oldwndproc lpvoid set window long ptr m hwnd gwlp wndproc long ptr explorer menu window proc create explorer menu return create explorer menu dir files m_hwnd explorermenu_map m_hwnd m_oldwndproc setwindowlongptr m_hwnd gwlp_wndproc long_ptr explorermenu windowproc createexplorermenu bool explorer menu fill menu hwnd hwnd const std string file m hwnd hwnd add instance to map explorermenu map m hwnd this add new window proc m oldwndproc lpvoid set window long ptr m hwnd gwlp wndproc long ptr explorer menu window proc create explorer menu std vector std string files return create explorer menu file files explorermenu fillmenu m_hwnd explorermenu_map m_hwnd m_oldwndproc setwindowlongptr m_hwnd gwlp_wndproc long_ptr explorermenu windowproc createexplorermenu const std vector std string files lpmalloc p malloc null lpshellfolder psf desktop folder null lpshellfolder psf my folder null lpitemidlist pidl main null lpitemidlist pidl parent null lpcitemidlist pidl files null lpitemidlist pidl file null lpcontextmenu p context menu null std string my dir unsigned int i bool b result false std vector std string const iterator it files std wstring ws path hresult hr get pointers to the shell s i malloc interface and the desktop s i shell folder interface if succeeded sh get malloc p malloc goto cleanup if succeeded sh get desktop folder psf desktop folder goto cleanup find folder my dir remove trailing delimiter dir convert to unicode ws path multibyte to wide dir convert the path name into a pointer to an item id list pidl hr psf desktop folder parse display name m hwnd null lpolestr ws path c str null pidl main null if failed hr pidl main null goto cleanup if files size 0 get dir hr psf desktop folder bind to object pidl main null iid ishellfolder lpvoid psf my folder if failed hr psf my folder null goto cleanup allocate memory for file pidls pidl files lpcitemidlist heap alloc get process heap heap zero memory sizeof lpitemidlist files size iterate through the filenames it files files begin i 0 while it files files end convert to unicode ws path multibyte to wide it files get pidl hr psf my folder parse display name m hwnd null lpolestr ws path c str null pidl file null if failed hr pidl file null goto cleanup pidl files i pidl file pidl file 0 it files i get a pointer to the item s i context menu interface and call i context menu query context menu to initialize a context menu hr psf my folder getui object of m hwnd files size pidl files iid icontextmenu null lpvoid p context menu else show context menu for the directory only pidl parent strip lastid pidl main pidl file get lastid pidl main hr psf desktop folder bind to object pidl parent null iid ishellfolder lpvoid psf my folder if failed hr psf my folder null goto cleanup get a pointer to the item s i context menu interface and call i context menu query context menu to initialize a context menu hr psf my folder getui object of m hwnd 1 lpcitemidlist pidl file iid icontextmenu null lpvoid p context menu if failed hr p context menu null goto cleanup hr p context menu query interface iid icontextmenu2 lpvoid m pcontextmenu2 if failed hr goto cleanup hr m pcontextmenu2 query context menu hmenu geth menu 0 1 0x7fff cmf explore if failed hr goto cleanup b result true cleanup for i 0 i files size i if pidl files i 0 p malloc free lpvoid pidl files i if pidl parent p malloc free lpvoid pidl parent if pidl file p malloc free lpvoid pidl file if pidl main p malloc free lpvoid pidl main if p malloc p malloc release if psf my folder psf my folder release if p context menu p context menu release if psf desktop folder psf desktop folder release if pidl files heap free get process heap 0 pidl files return b result pmalloc psfdesktopfolder psfmyfolder pidlmain pidlparent pidlfiles pidlfile pcontextmenu mydir bresult const_iterator itfiles wspath imalloc ishellfolder shgetmalloc pmalloc shgetdesktopfolder psfdesktopfolder mydir removetrailingdelimiter wspath multibytetowide psfdesktopfolder parsedisplayname m_hwnd wspath c_str pidlmain pidlmain psfdesktopfolder bindtoobject pidlmain iid_ishellfolder psfmyfolder psfmyfolder pidlfiles heapalloc getprocessheap heap_zero_memory itfiles itfiles wspath multibytetowide itfiles psfmyfolder parsedisplayname m_hwnd wspath c_str pidlfile pidlfile pidlfiles pidlfile pidlfile itfiles icontextmenu icontextmenu querycontextmenu psfmyfolder getuiobjectof m_hwnd pidlfiles iid_icontextmenu pcontextmenu pidlparent striplastid pidlmain pidlfile getlastid pidlmain psfdesktopfolder bindtoobject pidlparent iid_ishellfolder psfmyfolder psfmyfolder icontextmenu icontextmenu querycontextmenu psfmyfolder getuiobjectof m_hwnd pidlfile iid_icontextmenu pcontextmenu pcontextmenu pcontextmenu queryinterface iid_icontextmenu2 m_pcontextmenu2 m_pcontextmenu2 querycontextmenu gethmenu cmf_explore bresult pidlfiles pmalloc pidlfiles pidlparent pmalloc pidlparent pidlfile pmalloc pidlfile pidlmain pmalloc pidlmain pmalloc pmalloc psfmyfolder psfmyfolder pcontextmenu pcontextmenu psfdesktopfolder psfdesktopfolder pidlfiles heapfree getprocessheap pidlfiles bresult long explorer menu wnd proc const msg msg if m pcontextmenu2 msg message wm initmenupopup msg message wm drawitem msg message wm measureitem m pcontextmenu2 handle menu msg msg message msg w param msg l param return 0 if m pcontextmenu2 msg message wm command cminvokecommandinfo ici ici cb size sizeof cminvokecommandinfo ici hwnd m hwnd ici f mask 0 ici lp verb makeintresource msg w param 1 ici lp parameters null ici lp directory null ici n show sw shownormal ici dw hot key 0 ici h icon null set window long ptr m hwnd gwlp wndproc long ptr m oldwndproc hresult hr m pcontextmenu2 invoke command ici m oldwndproc lpvoid set window long ptr m hwnd gwlp wndproc long ptr explorer menu window proc if succeeded hr return 0 return call window proc wndproc m oldwndproc m hwnd msg message msg w param msg l param explorermenu wndproc m_pcontextmenu2 wm_initmenupopup wm_drawitem wm_measureitem m_pcontextmenu2 handlemenumsg wparam lparam m_pcontextmenu2 wm_command cbsize m_hwnd fmask lpverb wparam lpparameters lpdirectory nshow sw_shownormal dwhotkey hicon setwindowlongptr m_hwnd gwlp_wndproc long_ptr m_oldwndproc m_pcontextmenu2 invokecommand m_oldwndproc setwindowlongptr m_hwnd gwlp_wndproc long_ptr explorermenu windowproc callwindowproc m_oldwndproc m_hwnd wparam lparam wparam w param lparam l param find iterate through instances of explorer menu explorer menu me 0 if explorermenu map find hwnd explorermenu map end me explorermenu map hwnd if me msg msg msg message u msg msg w param w param msg l param l param me wnd proc msg return 0 def window proc hwnd u msg w param l param return 0 wparam lparam explorermenu explorermenu explorermenu_map explorermenu_map explorermenu_map umsg wparam wparam lparam lparam wndproc defwindowproc umsg wparam lparam const std vector item data item data std vector std string const iterator it filenames begin int i 0 while it filenames end my files insert item i it c str my files set checked i true my files set item data i long item data i item data i m format cvs status get file format item data i m filename my files set item i 1 cvs status file format string item data i m format c str my files set item i 2 cvs status file status string item data i m status c str it i itemdata itemdata const_iterator myfiles insertitem c_str myfiles setchecked myfiles setitemdata itemdata itemdata m_format cvsstatus getfileformat itemdata m_filename myfiles setitem cvsstatus fileformatstring itemdata m_format c_str myfiles setitem cvsstatus filestatusstring itemdata m_status c_str void filename text shorten filename int width does the whole filename fit wx string s label build label m templatetext m filenametext int x y get text extent s label x y if x width set label s label return tchar buf max path 1 int new len m filenametext length int d m filenametext length do path compact path ex buf m filenametext get data new len 0 s label build label m templatetext buf get text extent s label x y d d 1 2 if x width new len new len d else new len new len d while d 1 x width set label s label filenametext shortenfilename wxstring slabel buildlabel m_templatetext m_filenametext gettextextent slabel setlabel slabel _max_path newlen m_filenametext m_filenametext pathcompactpathex m_filenametext getdata newlen slabel buildlabel m_templatetext gettextextent slabel newlen newlen newlen newlen setlabel slabel bool c shell ext is ignoredid list lpcitemidlist pidl tdebug enter c shell ext is ignoredid list start menu if is special folder pidl csidl startmenu tdebug trace return true return true tdebug trace return false return false cshellext isignoredidlist tdebug_enter cshellext isignoredidlist isspecialfolder csidl_startmenu tdebug_trace tdebug_trace void c shell ext static init wx log set active target g log wx locale create languagesdb detect overlay icon status check language if windows version is2k hresult hr i shell folder psf desk top 0 hr sh get desktop folder psf desk top if succeeded hr hr psf desk top parse display name 0 0 l 450d8fba ad25 11d0 98a8 0800361b1103 0 m pidlmydocuments 0 psf desk top release cshellext staticinit wxlog setactivetarget g_log wxlocale createlanguagesdb detectoverlayiconstatus checklanguage windowsversionis2k ishellfolder psfdesktop shgetdesktopfolder psfdesktop psfdesktop parsedisplayname m_pidlmydocuments psfdesktop void c shell ext static release release overlay icon semaphore item list free m pidlmydocuments m pidlmydocuments 0 wx locale destroy languagesdb if g locale delete g locale cshellext staticrelease releaseoverlayiconsemaphore itemlistfree m_pidlmydocuments m_pidlmydocuments wxlocale destroylanguagesdb g_locale g_locale c shell ext c shell ext tortoiseole class tortoise class cs helper cs m csshellext true m mapshellext this 1 cs leave interlocked increment long g crefthisdll m tortoiseclass tortoise class m cref 0l cshellext cshellext tortoiseoleclass tortoiseclass cshelper m_csshellext m_mapshellext interlockedincrement g_crefthisdll m_tortoiseclass tortoiseclass m_cref c shell ext c shell ext context menu finalise clear menu bitmaps cs helper cs m csshellext true m mapshellext erase this cs leave interlocked decrement long g crefthisdll cshellext cshellext contextmenufinalise clearmenubitmaps cshelper m_csshellext m_mapshellext interlockeddecrement g_crefthisdll stdmethodimp c shell ext query interface refiid riid lpvoid far ppv ppv null if is equaliid riid iid ishellextinit is equaliid riid iid iunknown ppv i shell ext init this else if is equaliid riid iid icontextmenu ppv i context menu this else if is equaliid riid iid ishelliconoverlayidentifier ppv i shell icon overlay identifier this else if is equaliid riid iid ishellpropsheetext ppv i shell prop sheet ext this else if is equaliid riid iid icolumnprovider ppv i column provider this else if is equaliid riid iid iqueryinfo ppv i query info this else if is equaliid riid iid ipersistfile ppv i persist file this if ppv add ref return noerror return e nointerface cshellext queryinterface isequaliid iid_ishellextinit isequaliid iid_iunknown ishellextinit isequaliid iid_icontextmenu icontextmenu isequaliid iid_ishelliconoverlayidentifier ishelliconoverlayidentifier isequaliid iid_ishellpropsheetext ishellpropsheetext isequaliid iid_icolumnprovider icolumnprovider isequaliid iid_iqueryinfo iqueryinfo isequaliid iid_ipersistfile ipersistfile addref e_nointerface stdmethodimp ulong c shell ext add ref return m cref stdmethodimp_ cshellext addref m_cref stdmethodimp ulong c shell ext release if m cref return m cref delete this return 0l stdmethodimp_ cshellext m_cref m_cref stdmethodimp c shell ext get classid clsid pclsid pclsid clsid tortoisecvs0 return s ok cshellext getclassid clsid_tortoisecvs0 s_ok stdmethodimp c shell ext load lpcolestr psz file name dword dw mode tdebug enter c shell ext load tdebug trace psz file name m file psz file name return s ok cshellext pszfilename dwmode tdebug_enter cshellext tdebug_trace pszfilename m_file pszfilename s_ok hkey h reg key tdebug enter initialize tdebug trace pid folder pid folder tdebug trace p data obj p data obj check language signal that there are no files to work on m files clear if p data obj stgmedium medium formatetc fmte g shellidlist dvtargetdevice far null dvaspect content 1 tymed hglobal hresult hres p data obj get data fmte medium if succeeded hres medium h global enumerate pid ls which the user has selected cida cida cida medium h global lpcitemidlist parent folder getpidl folder cida tdebug trace parent folder get path fromid list parent folder int count cida cidl tdebug trace selected items count for int i 0 i count i lpcitemidlist child getpidl item cida i lpitemidlist absolute appendpidl parent folder child std string name get path fromid list absolute tdebug trace processing get path fromid list absolute if is ignoredid list absolute if is shortcut absolute don t follow shortcuts in cvs sandboxes if cvs status get file status name cvs status status nowherenear cvs lpitemidlist target get shortcut target absolute item list free absolute absolute target name get path fromid list target std string name get path fromid list absolute m files push back name else m files push back item list free absolute if medium p unk for release i unknown rel interface i unknown medium p unk for release rel interface release if a directory background if pid folder tdebug trace folder get path fromid list pid folder if is shortcut pid folder is ignoredid list pid folder std string dirname get path fromid list pid folder m files push back dirname else m files push back return noerror hregkey tdebug_enter tdebug_trace pidfolder pidfolder tdebug_trace pdataobj pdataobj checklanguage m_files pdataobj g_shellidlist dvaspect_content tymed_hglobal pdataobj getdata hglobal pidls hglobal parentfolder getpidlfolder tdebug_trace getpathfromidlist parentfolder tdebug_trace getpidlitem parentfolder getpathfromidlist tdebug_trace getpathfromidlist isignoredidlist isshortcut cvsstatus getfilestatus cvsstatus status_nowherenear_cvs getshortcuttarget itemlistfree getpathfromidlist getpathfromidlist m_files push_back m_files push_back itemlistfree punkforrelease iunknown relinterface iunknown punkforrelease relinterface pidfolder tdebug_trace getpathfromidlist pidfolder isshortcut pidfolder isignoredidlist pidfolder getpathfromidlist pidfolder m_files push_back m_files push_back stdmethodimp c shell ext get info tip dword dw flags wchar ppwsz tip tdebug enter c shell ext get info tip i malloc p malloc 0 hresult result s ok std wstring ws std string s file wide to multibyte m file 0 std vector std string negativelist std vector std string positivelist cs helper cs entnode entnode data node data 0 cvs status file status status bool has revision number bool has sticky tag bool has sticky date std string revision number std string sticky tag or date std string file format std string file status std stringstream ss check removable network drives in and excluded paths if cvs status is disabled path s file tdebug trace disabled path ppwsz tip 0 goto cleanup check language retrieve information node data cvs status get entnode data s file cs entnode status cvs status get file status node data if node data tdebug trace no data ppwsz tip 0 cs entnode leave goto cleanup has revision number cvs status has revision number node data if has revision number revision number cvs status get revision number node data has sticky tag cvs status has sticky tag node data if has sticky tag has sticky date cvs status has sticky date node data else has sticky date false if has sticky tag sticky tag or date cvs status get sticky tag node data else sticky tag or date cvs status get sticky date node data if is directory s file c str file format folder else file format cvs status file format string cvs status get file format node data cs entnode leave cvs status if status cvs status status notincvs status cvs status status nowherenear cvs file status else file status cvs status file status string status ss cvs revision revision number n cvs sticky tag sticky tag or date n cvs status file status n cvs file format file format ws multibyte to wide ss str 0 if succeeded sh get malloc p malloc goto cleanup ppwsz tip lpwstr p malloc alloc ws length 1 sizeof wchar lstrcpyw ppwsz tip ws c str cleanup if p malloc p malloc release return result cshellext getinfotip dwflags ppwsztip tdebug_enter cshellext getinfotip imalloc pmalloc s_ok sfile widetomultibyte m_file cshelper csentnode entnodedata nodedata cvsstatus filestatus hasrevisionnumber hasstickytag hasstickydate revisionnumber stickytagordate fileformat filestatus cvsstatus isdisabledpath sfile tdebug_trace ppwsztip checklanguage nodedata cvsstatus getentnodedata sfile csentnode cvsstatus getfilestatus nodedata nodedata tdebug_trace ppwsztip csentnode hasrevisionnumber cvsstatus hasrevisionnumber nodedata hasrevisionnumber revisionnumber cvsstatus getrevisionnumber nodedata hasstickytag cvsstatus hasstickytag nodedata hasstickytag hasstickydate cvsstatus hasstickydate nodedata hasstickydate hasstickytag stickytagordate cvsstatus getstickytag nodedata stickytagordate cvsstatus getstickydate nodedata isdirectory sfile c_str fileformat _ fileformat cvsstatus fileformatstring cvsstatus getfileformat nodedata csentnode cvsstatus status_notincvs cvsstatus status_nowherenear_cvs filestatus filestatus cvsstatus filestatusstring _ revisionnumber _ stickytagordate _ filestatus _ fileformat multibytetowide shgetmalloc pmalloc ppwsztip pmalloc ppwsztip c_str pmalloc pmalloc stdmethodimp c shell ext get info flags dword pdw flags tdebug enter c shell ext get info flags pdw flags 0 return s ok cshellext getinfoflags pdwflags tdebug_enter cshellext getinfoflags pdwflags s_ok lparam l param only show property sheet if there s something worth showing check language if has menu has menu const m files return noerror propsheetpage psp hpropsheetpage h page cvs revisions prop sheet sheet new cvs revisions prop sheet m files 0 psp dw size sizeof psp psp dw flags psp userefparent psp usetitle psp useiconid psp usecallback psp h instance g hinstance psp psz template revisions psp psz icon idi tortoise psp psz title cvs psp pfn dlg proc page proc psp l param reinterpret cast lparam sheet psp pfn callback prop page callback proc psp pc ref parent g crefthisdll h page create property sheet page psp if h page if lpfn add page h page l param delete sheet destroy property sheet page h page return noerror lparam checklanguage hasmenu hasmenuconst m_files hpage cvsrevisionspropsheet cvsrevisionspropsheet m_files dwsize dwflags psp_userefparent psp_usetitle psp_useiconid psp_usecallback hinstance g_hinstance psztemplate pszicon idi_tortoise psztitle pfndlgproc pageproc lparam reinterpret_cast pfncallback proppagecallbackproc pcrefparent g_crefthisdll hpage createpropertysheetpage hpage lpfnaddpage hpage lparam destroypropertysheetpage hpage lparam l param return e fail lparam e_fail void c shell ext detect overlay icon status tdebug enter c shell ext detect overlay icon status tortoise overlay icon status overlay icon status m useoverlayicons false m overlayiconsemaphore 0 check registry for override settings int i tortoise registry read integer overlay icon status 1 if i 0 tdebug trace registry disable overlay icons overlay icon status tortoise overlay icon disable else if i 1 tdebug trace registry use overlay icons in first explorer overlay icon status tortoise overlay icon first explorer else if i 2 tdebug trace registry enable overlay icons overlay icon status tortoise overlay icon enable check operating system else nt 4 if windows version isnt4 tdebug trace win nt 4 use overlay icons in first explorer overlay icon status tortoise overlay icon first explorer win 95 else if windows version is95 tdebug trace win 95 use overlay icons in first explorer overlay icon status tortoise overlay icon first explorer else tdebug trace registry enable overlay icons overlay icon status tortoise overlay icon enable if overlay icon status tortoise overlay icon disable m useoverlayicons false else if overlay icon status tortoise overlay icon enable m useoverlayicons true else char buf max path 1 get module file name 0 buf sizeof buf 1 std string filename buf filename get last part filename make lower case filename tdebug trace current process is filename if filename explorer exe tdebug trace we re not explorer so disable overlay icons m useoverlayicons false else tdebug trace check semaphore m overlayiconsemaphore create semaphore 0 1 1 tortoise overlay icons if get last error error already exists tdebug trace semaphore already exists if get last error error success tdebug trace semaphore created if m overlayiconsemaphore 0 dword dw wait result wait for single object m overlayiconsemaphore 0 if dw wait result wait object 0 tdebug trace wait succeeded so enable overlay icons m useoverlayicons true else tdebug trace wait failed so disable overlay icons m useoverlayicons false close handle m overlayiconsemaphore m overlayiconsemaphore 0 cshellext detectoverlayiconstatus tdebug_enter cshellext detectoverlayiconstatus tortoiseoverlayiconstatus overlayiconstatus m_useoverlayicons m_overlayiconsemaphore tortoiseregistry readinteger overlayiconstatus tdebug_trace overlayiconstatus tortoise_overlay_icon_disable tdebug_trace overlayiconstatus tortoise_overlay_icon_first_explorer tdebug_trace overlayiconstatus tortoise_overlay_icon_enable windowsversionisnt4 tdebug_trace overlayiconstatus tortoise_overlay_icon_first_explorer windowsversionis95 tdebug_trace overlayiconstatus tortoise_overlay_icon_first_explorer tdebug_trace overlayiconstatus tortoise_overlay_icon_enable overlayiconstatus tortoise_overlay_icon_disable m_useoverlayicons overlayiconstatus tortoise_overlay_icon_enable m_useoverlayicons _max_path getmodulefilename getlastpart makelowercase tdebug_trace tdebug_trace m_useoverlayicons tdebug_trace m_overlayiconsemaphore createsemaphore tortoiseoverlayicons getlasterror error_already_exists tdebug_trace getlasterror error_success tdebug_trace m_overlayiconsemaphore dwwaitresult waitforsingleobject m_overlayiconsemaphore dwwaitresult wait_object_0 tdebug_trace m_useoverlayicons tdebug_trace m_useoverlayicons closehandle m_overlayiconsemaphore m_overlayiconsemaphore void c shell ext release overlay icon semaphore tdebug enter c shell ext release overlay icon semaphore if m overlayiconsemaphore 0 tdebug trace release semaphore release semaphore m overlayiconsemaphore 1 null close handle m overlayiconsemaphore cshellext releaseoverlayiconsemaphore tdebug_enter cshellext releaseoverlayiconsemaphore m_overlayiconsemaphore tdebug_trace releasesemaphore m_overlayiconsemaphore closehandle m_overlayiconsemaphore stdmethodimp c shell ext get overlay info lpwstr pwsz icon file int cch max int p index dword pdw flags tdebug enter c shell ext get overlay info test if we are in explorer if m useoverlayicons tdebug trace don t use overlay icons return s false check language which icon set to use std string s icons tortoise registry read string icons tortoisecvs tdebug trace icon set path s icons std string dir get icon set path s icons if dir empty tdebug trace path is empty wcsncpy pwsz icon file l cch max p index 0 pdw flags isioi iconfile return s ok dir ensure trailing delimiter dir std wstring dir wide multibyte to wide dir wcsncpy pwsz icon file dir wide c str cch max cch max dir wide size 1 add name of appropriate icon switch m tortoiseclass case tortoise ole conflict wcsncat pwsz icon file l tortoise conflict ico cch max break case tortoise ole changed wcsncat pwsz icon file l tortoise changed ico cch max break case tortoise ole notincvs wcsncat pwsz icon file l tortoise not incvs ico cch max break case tortoise ole incvs wcsncat pwsz icon file l tortoise incvs ico cch max break case tortoise ole incvsreadonly wcsncat pwsz icon file l tortoise incvs read only ico cch max break case tortoise ole ignored wcsncat pwsz icon file l tortoise ignored ico cch max break case tortoise ole added wcsncat pwsz icon file l tortoise added ico cch max break default return s false tdebug trace path wide to multibyte pwsz icon file p index 0 pdw flags isioi iconfile return s ok cshellext getoverlayinfo pwsziconfile cchmax pindex pdwflags tdebug_enter cshellext getoverlayinfo m_useoverlayicons tdebug_trace s_false checklanguage sicons tortoiseregistry readstring tdebug_trace sicons geticonsetpath sicons tdebug_trace pwsziconfile cchmax pindex pdwflags isioi_iconfile s_ok ensuretrailingdelimiter dirwide multibytetowide pwsziconfile dirwide c_str cchmax cchmax dirwide m_tortoiseclass tortoise_ole_conflict pwsziconfile tortoiseconflict cchmax tortoise_ole_changed pwsziconfile tortoisechanged cchmax tortoise_ole_notincvs pwsziconfile tortoisenotincvs cchmax tortoise_ole_incvs pwsziconfile tortoiseincvs cchmax tortoise_ole_incvsreadonly pwsziconfile tortoiseincvsreadonly cchmax tortoise_ole_ignored pwsziconfile tortoiseignored cchmax tortoise_ole_added pwsziconfile tortoiseadded cchmax s_false tdebug_trace widetomultibyte pwsziconfile pindex pdwflags isioi_iconfile s_ok stdmethodimp c shell ext get priority int p priority tdebug enter c shell ext get priority switch m tortoiseclass case tortoise ole conflict p priority 60 break case tortoise ole changed p priority 30 break case tortoise ole ignored p priority 20 break case tortoise ole notincvs p priority 90 break case tortoise ole incvsreadonly p priority 50 break case tortoise ole incvs p priority 10 break case tortoise ole added p priority 25 break default return s false tdebug trace priority p priority return s ok cshellext getpriority ppriority tdebug_enter cshellext getpriority m_tortoiseclass tortoise_ole_conflict ppriority tortoise_ole_changed ppriority tortoise_ole_ignored ppriority tortoise_ole_notincvs ppriority tortoise_ole_incvsreadonly ppriority tortoise_ole_incvs ppriority tortoise_ole_added ppriority s_false tdebug_trace ppriority s_ok stdmethodimp c shell ext is member of lpcwstr pwsz path dword dw attrib tdebug enter c shell ext is member of check language cvs status file status status cvs status status incvs ro std string path wide to multibyte std wstring pwsz path tdebug trace is member of path check cache cs helper cs m ismemberofcs true is member of info data 0 dword tc get tick count bool b get uncached false tdebug trace search cache for path data m ismemberofcache find path if data tdebug trace found path in cache if tc data m timestamp is member of cache timeout tdebug trace not outdated if data m ignore return s false else status data m status else tdebug trace outdated b get uncached true if data tdebug trace create new entry data m ismemberofcache insert path b get uncached true if b get uncached data m timestamp tc tdebug trace get data uncached check removable network drives in and excluded paths if cvs status is disabled path path tdebug trace disabled path data m ignore true return s false status cvs status get file status recursive path 1 1 data m status status cs leave tdebug trace file status path status if status cvs status status nowherenear cvs return s false switch m tortoiseclass case tortoise ole ignored if status cvs status status ignored tdebug trace member of tortoise ole ignored return s ok break case tortoise ole conflict if status cvs status status conflict tdebug trace member of tortoise ole conflict return s ok break case tortoise ole incvsreadonly if status cvs status status incvs ro tdebug trace member of tortoise ole incvsreadonly return s ok break case tortoise ole added if status cvs status status added tdebug trace member of tortoise ole added return s ok break case tortoise ole changed if status cvs status status changed status cvs status status removed status cvs status status missing tdebug trace member of tortoise ole changed return s ok break case tortoise ole notincvs if status cvs status status notincvs tdebug trace member of tortoise ole notincvs return s ok break case tortoise ole incvs if status cvs status status incvs rw status cvs status status outerdirectory tdebug trace member of tortoise ole incvs return s ok break default return s false return s false cshellext ismemberof pwszpath dwattrib tdebug_enter cshellext ismemberof checklanguage cvsstatus filestatus cvsstatus status_incvs_ro widetomultibyte pwszpath tdebug_trace ismemberof cshelper m_ismemberofcs ismemberofinfo gettickcount bgetuncached tdebug_trace m_ismemberofcache tdebug_trace m_timestamp is_member_of_cache_timeout tdebug_trace m_ignore s_false m_status tdebug_trace bgetuncached tdebug_trace m_ismemberofcache bgetuncached bgetuncached m_timestamp tdebug_trace cvsstatus isdisabledpath tdebug_trace m_ignore s_false cvsstatus getfilestatusrecursive m_status tdebug_trace filestatus cvsstatus status_nowherenear_cvs s_false m_tortoiseclass tortoise_ole_ignored cvsstatus status_ignored tdebug_trace tortoise_ole_ignored s_ok tortoise_ole_conflict cvsstatus status_conflict tdebug_trace tortoise_ole_conflict s_ok tortoise_ole_incvsreadonly cvsstatus status_incvs_ro tdebug_trace tortoise_ole_incvsreadonly s_ok tortoise_ole_added cvsstatus status_added tdebug_trace tortoise_ole_added s_ok tortoise_ole_changed cvsstatus status_changed cvsstatus status_removed cvsstatus status_missing tdebug_trace tortoise_ole_changed s_ok tortoise_ole_notincvs cvsstatus status_notincvs tdebug_trace tortoise_ole_notincvs s_ok tortoise_ole_incvs cvsstatus status_incvs_rw cvsstatus status_outerdirectory tdebug_trace tortoise_ole_incvs s_ok s_false s_false uint u flags tdebug enter c shell ext query context menu if are shell ext targets avail return noerror check language context menu initialise u flags cmf reserved if u flags cmf noverbs u flags cmf verbsonly u flags cmf includestatic u flags cmf defaultonly clear menu bitmaps std string submenu name tortoise registry read string sub menu name c vs uint id cmd id cmd first int index 0 menuiteminfo mi mi cb size sizeof mi separator before mi f mask miim type mi f type mft separator insert menu item h menu index menu true mi tdebug trace delete any existing cvs submenu delete any existing c vs submenu this is a workaround for an explorer bug it removes all normal menu items but not submenu items that we added previously this is on the main file menu for popup context menus the menu must be generated afresh so everything is fine char buf max path int count get menu item count h menu for int j 0 j count j get menu string h menu j buf sizeof buf 1 mf byposition if std string buf submenu name delete menu h menu j mf byposition this is deleted because destroy menu is recursive hopefully explorer just calls that hmenu sub menu create menu int index sub menu 0 bool has sub menu false todo better separator mechanism bool previous sub menu was separator true stop two adjacent separators std string previousverb tdebug trace iterate through my menus unsigned int i std vector bool has menus m menus size std vector int menu flags m menus size for i 0 i m menus size i menu flags i m menus i get flags has menus menu flags m files has menus for i 0 i m menus size i menu description menu description m menus i if has menus i if menu description get verb empty menu description get verb previousverb continue previousverb menu description get verb add item to either submenu or main menu if menu description get flags on sub menu submenu if menu description get verb empty this is a separator if previous sub menu was separator mi f mask miim type mi f type mft separator insert menu item sub menu index sub menu true mi id cmd previous sub menu was separator true else std string menu text menu description get menu text c str mi f mask miim type miim id mi f type mft string mi dw type data lptstr menu text c str mi cch menu text length mi wid id cmd if tortoise registry read boolean context icons true hbitmap h get menu bitmap menu description get icon if h mi f mask miim checkmarks miim state mi f state mfs unchecked mi hbmp checked 0 mi hbmp unchecked h insert menu item sub menu index sub menu true mi id cmd has sub menu true previous sub menu was separator false we store the relative and absolute diameter drawitem callback uses absolute others relative myid map id cmd id cmd first 1 i myid map id cmd 1 i else main menu if menu description get verb empty this is a separator mi f mask miim type mi f type mft separator insert menu item h menu index menu true mi id cmd else std string menu text cvs menu text menu description get menu text c str mi f mask miim type miim id mi f type mft string mi dw type data lptstr menu text c str mi cch menu text length mi wid id cmd if tortoise registry read boolean context icons true hbitmap h get menu bitmap menu description get icon if h mi f mask miim checkmarks miim state mi f state mfs unchecked mi hbmp checked 0 mi hbmp unchecked h insert menu item h menu index menu true mi menu description set index index id cmd we store the relative and absolute diameter drawitem callback uses absolute others relative myid map id cmd id cmd first 1 i myid map id cmd 1 i tdebug trace add sub menu to main menu std string text std string submenu name if has sub menu mi f mask miim type miim submenu mi f type mft string mi dw type data lptstr text c str mi cch text length mi h sub menu sub menu if tortoise registry read boolean context icons true hbitmap h get menu bitmap tortoise if h mi f mask miim checkmarks miim state mi f state mfs unchecked mi hbmp checked 0 mi hbmp unchecked h insert menu item h menu index menu true mi else destroy menu sub menu separator after mi f mask miim type mi f type mft separator insert menu item h menu index menu true mi return number of menu items that we added return result from scode make scode severity success 0 ushort id cmd id cmd first return noerror uflags tdebug_enter cshellext querycontextmenu areshellexttargetsavail checklanguage contextmenuinitialise uflags cmf_reserved uflags cmf_noverbs uflags cmf_verbsonly uflags cmf_includestatic uflags cmf_defaultonly clearmenubitmaps submenuname tortoiseregistry readstring submenuname idcmd idcmdfirst cbsize fmask miim_type ftype mft_separator insertmenuitem hmenu indexmenu tdebug_trace _max_path getmenuitemcount hmenu getmenustring hmenu mf_byposition submenuname deletemenu hmenu mf_byposition destroymenu submenu createmenu indexsubmenu hassubmenu previoussubmenuwasseparator tdebug_trace mymenus hasmenus m_menus menuflags m_menus m_menus menuflags m_menus getflags hasmenus menuflags m_files hasmenus m_menus menudescription menudescription m_menus hasmenus menudescription getverb menudescription getverb menudescription getverb menudescription getflags on_sub_menu menudescription getverb previoussubmenuwasseparator fmask miim_type ftype mft_separator insertmenuitem submenu indexsubmenu idcmd previoussubmenuwasseparator menutext _ menudescription getmenutext c_str fmask miim_type miim_id ftype mft_string dwtypedata menutext c_str menutext idcmd tortoiseregistry readboolean contexticons getmenubitmap menudescription geticon fmask miim_checkmarks miim_state fstate mfs_unchecked hbmpchecked hbmpunchecked insertmenuitem submenu indexsubmenu idcmd hassubmenu previoussubmenuwasseparator myidmap idcmd idcmdfirst myidmap idcmd menudescription getverb fmask miim_type ftype mft_separator insertmenuitem hmenu indexmenu idcmd menutext menutext _ menudescription getmenutext c_str fmask miim_type miim_id ftype mft_string dwtypedata menutext c_str menutext idcmd tortoiseregistry readboolean contexticons getmenubitmap menudescription geticon fmask miim_checkmarks miim_state fstate mfs_unchecked hbmpchecked hbmpunchecked insertmenuitem hmenu indexmenu menudescription setindex idcmd myidmap idcmd idcmdfirst myidmap idcmd tdebug_trace submenuname hassubmenu fmask miim_type miim_submenu ftype mft_string dwtypedata c_str hsubmenu submenu tortoiseregistry readboolean contexticons getmenubitmap fmask miim_checkmarks miim_state fstate mfs_unchecked hbmpchecked hbmpunchecked insertmenuitem hmenu indexmenu destroymenu submenu fmask miim_type ftype mft_separator insertmenuitem hmenu indexmenu resultfromscode make_scode severity_success idcmd idcmdfirst stdmethodimp c shell ext invoke command lpcminvokecommandinfo lpcmi tdebug enter c shell ext invoke command check language context menu initialise hresult hr e invalidarg if hiword lpcmi lp verb then we have been called programmatically and lp verb is a command that should be invoked otherwise the shell has called us and loword lpcmi lp verb is the menu id the user has selected actually it s menu id id cmd first from query context menu menu description menu description null if hiword lpcmi lp verb if are shell ext targets avail return hr uint id cmd loword lpcmi lp verb see if we have a handler interface for this id if myid map find id cmd myid map end menu description m menus myid map id cmd else see if we have a handler interface for this verb if my verb map find lpcmi lp verb my verb map end menu description m menus my verb map lpcmi lp verb now we have our handler we can perform the action if menu description hr noerror if defined debug tdebug trace verb menu description get verb test crash dump if stricmp menu description get verb c str cvs about verb c str 0 is control down is shift down message box 0 testing crash dump in tortoise shell test 0 int p 0 p 0 endif menu description perform m files lpcmi hwnd return hr cshellext invokecommand tdebug_enter cshellext invokecommand checklanguage contextmenuinitialise e_invalidarg lpverb lpverb lpverb idcmdfirst querycontextmenu menudescription menudescription lpverb areshellexttargetsavail idcmd lpverb myidmap idcmd myidmap menudescription m_menus myidmap idcmd myverbmap lpverb myverbmap menudescription m_menus myverbmap lpverb menudescription _debug tdebug_trace menudescription getverb menudescription getverb c_str cvsaboutverb c_str iscontroldown isshiftdown messagebox tortoiseshell menudescription m_files uint cch max see if we have a handler interface for this id if myid map find id cmd myid map end return e invalidarg check language menu description iface m menus myid map id cmd hresult hr e invalidarg return the appropriate help text or verb for the command handler switch u flags case gcs helptexta std string help iface get help text c str lstrcpyna psz name help c str cch max hr s ok break case gcs helptextw std wstring help multibyte to wide iface get help text c str lstrcpynw lpwstr psz name help c str cch max hr s ok break case gcs verba leave this untranslated std string verb iface get verb lstrcpyna psz name verb c str cch max hr s ok break case gcs verbw leave this untranslated std wstring verb multibyte to wide iface get verb lstrcpynw lpwstr psz name verb c str cch max hr s ok break default hr s ok break return hr cchmax myidmap idcmd myidmap e_invalidarg checklanguage menudescription m_menus myidmap idcmd e_invalidarg uflags gcs_helptexta _ gethelptext c_str pszname c_str cchmax s_ok gcs_helptextw multibytetowide _ gethelptext c_str pszname c_str cchmax s_ok gcs_verba getverb pszname c_str cchmax s_ok gcs_verbw multibytetowide getverb pszname c_str cchmax s_ok s_ok void c shell ext context menu initialise tdebug enter c shell ext context menu initialise cs helper cs m csshellext true if defined debug if m bcontextmenuinitialised endif m menus clear fill in default menus m menus index by verb for unsigned int i 0 i m menus size i std string verb m menus i get verb my verb map verb i m bcontextmenuinitialised true cshellext contextmenuinitialise tdebug_enter cshellext contextmenuinitialise cshelper m_csshellext _debug m_bcontextmenuinitialised m_menus fillindefaultmenus m_menus m_menus m_menus getverb myverbmap m_bcontextmenuinitialised void c shell ext context menu finalise cshellext contextmenufinalise hbitmap c shell ext get menu bitmap const std string verb tdebug enter c shell ext get menu bitmap tdebug trace verb verb hdc hdc 0 hdc h screendc 0 int bmp x bmp y hbitmap result 0 hbitmap hbm temp hbrush h brush 0 hicon h icon 0 rect r std string iconname if verb empty return 0 if my menu bitmap map find verb my menu bitmap map end return my menu bitmap map verb get bitmap dimensions bmp x get system metrics sm cxmenucheck bmp y get system metrics sm cymenucheck create bitmap h screendc createdc text display null null null hdc create compatibledc h screendc if hdc goto cleanup result create compatible bitmap h screendc bmp x bmp y if result goto cleanup hbm temp hbitmap select object hdc result draw bitmap background r left 0 r right bmp x r top 0 r bottom bmp y h brush create solid brush rgb 255 255 255 fill rect hdc r h brush load icon iconname std string idi verb make upper case iconname tdebug trace iconname iconname load icon in h icon hicon load image g hinstance iconname c str image icon bmp x bmp y lr defaultcolor if h icon goto cleanup draw icon ex hdc bmp x bmp y 2 bmp y bmp y 2 h icon bmp y bmp y 0 null di normal select object hdc hbm temp my menu bitmap map verb result cleanup if h screendc deletedc h screendc if h brush delete object h brush if hdc deletedc hdc if h icon destroy icon h icon return result cshellext getmenubitmap tdebug_enter cshellext getmenubitmap tdebug_trace hscreendc bmp_x bmp_y hbmtemp hbrush hicon mymenubitmapmap mymenubitmapmap mymenubitmapmap bmp_x getsystemmetrics sm_cxmenucheck bmp_y getsystemmetrics sm_cymenucheck hscreendc createcompatibledc hscreendc createcompatiblebitmap hscreendc bmp_x bmp_y hbmtemp selectobject bmp_x bmp_y hbrush createsolidbrush fillrect hbrush idi_ makeuppercase tdebug_trace hicon loadimage g_hinstance c_str image_icon bmp_x bmp_y lr_defaultcolor hicon drawiconex bmp_x bmp_y bmp_y bmp_y hicon bmp_y bmp_y di_normal selectobject hbmtemp mymenubitmapmap hscreendc hscreendc hbrush deleteobject hbrush hicon destroyicon hicon void c shell ext clear menu bitmaps for std map std string hbitmap iterator it my menu bitmap map begin it my menu bitmap map end it delete object it second my menu bitmap map clear cshellext clearmenubitmaps mymenubitmapmap mymenubitmapmap deleteobject mymenubitmapmap c shell ext class factory c shell ext class factory tortoiseole class class to make interlocked increment long g crefthisdll m classtomake class to make m cref 0l cshellextclassfactory cshellextclassfactory tortoiseoleclass classtomake interlockedincrement g_crefthisdll m_classtomake classtomake m_cref c shell ext class factory c shell ext class factory interlocked decrement long g crefthisdll cshellextclassfactory cshellextclassfactory interlockeddecrement g_crefthisdll lpvoid far ppv ppv null any interface on this object is the object pointer if is equaliid riid iid iunknown is equaliid riid iid iclassfactory ppv lpclassfactory this add ref return noerror return e nointerface isequaliid iid_iunknown isequaliid iid_iclassfactory addref e_nointerface stdmethodimp ulong c shell ext class factory add ref return m cref stdmethodimp_ cshellextclassfactory addref m_cref stdmethodimp ulong c shell ext class factory release if m cref return m cref delete this return 0l stdmethodimp_ cshellextclassfactory m_cref m_cref lpvoid ppv obj ppv obj null shell extensions typically don t support aggregation inheritance if p unk outer return class e noaggregation create the main shell extension object the shell will then call query interface with iid ishellextinit this is how shell extensions are initialized c shell ext p shell ext new c shell ext m classtomake create the c shell ext object if null p shell ext return e outofmemory return p shell ext query interface riid ppv obj ppvobj ppvobj punkouter class_e_noaggregation queryinterface iid_ishellextinit cshellext pshellext cshellext m_classtomake cshellext pshellext e_outofmemory pshellext queryinterface ppvobj stdmethodimp c shell ext class factory lock server bool f lock return noerror cshellextclassfactory lockserver flock dw file size low 0 dw file size high 0 memset ft last write time 0 sizeof ft last write time dwfilesizelow dwfilesizehigh ftlastwritetime ftlastwritetime bool operator file change params fcp return ft last write time dw low date time fcp ft last write time dw low date time ft last write time dw high date time fcp ft last write time dw high date time dw file size low fcp dw file size low dw file size high fcp dw file size high filechangeparams ftlastwritetime dwlowdatetime ftlastwritetime dwlowdatetime ftlastwritetime dwhighdatetime ftlastwritetime dwhighdatetime dwfilesizelow dwfilesizelow dwfilesizehigh dwfilesizehigh bool operator file change params fcp return ft last write time dw low date time fcp ft last write time dw low date time ft last write time dw high date time fcp ft last write time dw high date time dw file size low fcp dw file size low dw file size high fcp dw file size high filechangeparams ftlastwritetime dwlowdatetime ftlastwritetime dwlowdatetime ftlastwritetime dwhighdatetime ftlastwritetime dwhighdatetime dwfilesizelow dwfilesizelow dwfilesizehigh dwfilesizehigh bool is null return ft last write time dw low date time 0 ft last write time dw high date time 0 dw file size low 0 dw file size high 0 isnull ftlastwritetime dwlowdatetime ftlastwritetime dwhighdatetime dwfilesizelow dwfilesizehigh void set null ft last write time dw low date time 0 ft last write time dw high date time 0 dw file size low 0 dw file size high 0 setnull ftlastwritetime dwlowdatetime ftlastwritetime dwhighdatetime dwfilesizelow dwfilesizehigh std string as string std ostringstream msg systemtime st file time to system time ft last write time st char buf 100 sprintf buf 2 2d 2 2d 2 2d 2 2d 2 2d 2 2d st w day st w month st w year 100 st w hour st w minute st w second msg time buf size dw file size low return msg str asstring filetimetosystemtime ftlastwritetime wday wmonth wyear whour wminute wsecond dwfilesizelow bool exists if exists exists false std string s key std string s name hkey root keys 0 int root key count 0 parse registry path name root keys root key count s key s name dword len dword type for int k 0 k root key count k hkey key if reg open key ex root keys k s key c str 0 key read key error success continue len 2048 char buf char malloc len long res reg query value ex key s name c str null type unsigned char buf len if res error more data free buf buf char malloc len res reg query value ex key s name c str null type unsigned char buf len if res error success type reg sz type reg expand sz free buf reg close key key continue if exists exists true reg close key key if type reg expand sz std string result buf free buf return expand env strings result else std string result buf free buf return result return default value skey sname rootkeys rootkeycount parseregistrypath rootkeys rootkeycount skey sname rootkeycount regopenkeyex rootkeys skey c_str key_read error_success regqueryvalueex sname c_str error_more_data regqueryvalueex sname c_str error_success reg_sz reg_expand_sz regclosekey regclosekey reg_expand_sz expandenvstrings defaultvalue void tortoise registry write string const std string name const std string value std string s key std string s name hkey root key 0 parse registry path name root key 0 s key s name hkey key if reg create key ex root key s key c str 0 null 0 key write null key null error success return reg set value ex key s name c str 0 reg sz unsigned char value c str value size 1 include null in length for winnt reg close key key tortoiseregistry writestring skey sname rootkey parseregistrypath rootkey skey sname regcreatekeyex rootkey skey c_str key_write error_success regsetvalueex sname c_str reg_sz c_str regclosekey int tortoise registry read integer const std string name int default value std string s key std string s name hkey root keys 0 int root key count 0 parse registry path name root keys root key count s key s name dword value dword len dword type for int k 0 k root key count k hkey key if reg open key ex root keys k s key c str 0 key read key error success continue len sizeof value if reg query value ex key s name c str null type unsigned char value len error success type reg dword reg close key key continue reg close key key return value return default value tortoiseregistry readinteger defaultvalue skey sname rootkeys rootkeycount parseregistrypath rootkeys rootkeycount skey sname rootkeycount regopenkeyex rootkeys skey c_str key_read error_success regqueryvalueex sname c_str error_success reg_dword regclosekey regclosekey defaultvalue void tortoise registry write integer const std string name int value std string s key std string s name hkey root key 0 parse registry path name root key 0 s key s name hkey key if reg create key ex root key s key c str 0 null 0 key write null key null error success return reg set value ex key s name c str 0 reg dword unsigned char value sizeof value reg close key key tortoiseregistry writeinteger skey sname rootkey parseregistrypath rootkey skey sname regcreatekeyex rootkey skey c_str key_write error_success regsetvalueex sname c_str reg_dword regclosekey bool tortoise registry read boolean const std string name bool default value int value read integer name default value 1 0 return value 1 true false tortoiseregistry readboolean defaultvalue readinteger defaultvalue void tortoise registry write boolean const std string name bool value write integer name value 1 0 tortoiseregistry writeboolean writeinteger int maxsize int i 0 int def std numeric limits int min while i maxsize std stringstream ss ss basekey ss std setw vector digits std setfill 0 i std ends int value tortoise registry read integer ss str def if value def break ints push back value i numeric_limits vector_digits tortoiseregistry readinteger push_back int maxsize clear old entries tortoise registry erase values prefix basekey std vector int const iterator it int i 0 for it ints begin it ints end i maxsize it std stringstream ss ss basekey ss std setw vector digits std setfill 0 i std ends tortoise registry write integer ss str it i tortoiseregistry erasevaluesprefix const_iterator vector_digits tortoiseregistry writeinteger unsigned int maxsize read existing values std vector std string values read vector basekey values remove existing values from vector std vector std string iterator it values begin while it values end if it value it values erase it else it add new value values push back value remove first oldest value if necessary while values size maxsize values erase values begin write back write vector basekey values maxsize readvector push_back writevector unsigned int maxsize read existing values std vector std string values read vector basekey values remove existing values from vector std vector std string iterator it values begin while it values end if it value it values erase it else it add new value values insert values begin value remove last oldest value if necessary while values size maxsize values pop back write back write vector basekey values readvector pop_back writevector bool tortoise registry read size std string const name int width int height if width height return false std string value tortoise registry read string name if value empty return false std string size type pos value find if pos std string npos return false width atoi value substr 0 pos c str height atoi value substr pos 1 c str return true tortoiseregistry readsize tortoiseregistry readstring size_type c_str c_str void tortoise registry write size std string const name int width int height std stringstream ss ss width height std ends tortoise registry write string name ss str tortoiseregistry writesize tortoiseregistry writestring void tortoise registry erase value const std string name std string s key std string s name hkey root key 0 parse registry path name root key 0 s key s name hkey key if reg open key ex root key s key c str 0 key write key error success return ignore return value reg delete value key name c str reg close key key tortoiseregistry erasevalue skey sname rootkey parseregistrypath rootkey skey sname regopenkeyex rootkey skey c_str key_write error_success regdeletevalue c_str regclosekey void tortoise registry erase values prefix std string const name std string s key std string s name hkey root key 0 parse registry path name root key 0 s key s name hkey key if reg open key ex root key s key c str 0 key read key write key error success return dword dw index 0 dword cb value name char sz value name 1024 std vector std string v bool b repeat true while b repeat cb value name sizeof sz value name 1 enumerate values if reg enum value key dw index sz value name cb value name 0 0 0 0 error success break if strnicmp sz value name s name c str s name length 0 v push back sz value name dw index std vector std string iterator it v begin while it v end reg delete value key it c str it reg close key key tortoiseregistry erasevaluesprefix skey sname rootkey parseregistrypath rootkey skey sname regopenkeyex rootkey skey c_str key_read key_write error_success dwindex cbvaluename szvaluename brepeat brepeat cbvaluename szvaluename regenumvalue dwindex szvaluename cbvaluename error_success szvaluename sname c_str sname push_back szvaluename dwindex regdeletevalue c_str regclosekey void tortoise registry read value names const std string basekey std vector std string names std string s key std string s name hkey root keys 0 int root key count 0 parse registry path ensure trailing delimiter basekey root keys root key count s key s name hkey key 0 dword dw index 0 char buf 2048 dword len long reg result open key for int k 0 k root key count k if reg open key ex root keys k s key c str 0 key read key error success break key 0 if key goto cleanup do len sizeof buf reg result reg enum value key dw index buf len null null null null if reg result error success names push back buf dw index while reg result error success cleanup if key 0 reg close key key tortoiseregistry readvaluenames skey sname rootkeys rootkeycount parseregistrypath ensuretrailingdelimiter rootkeys rootkeycount skey sname dwindex regresult rootkeycount regopenkeyex rootkeys skey c_str key_read error_success regresult regenumvalue dwindex regresult error_success push_back dwindex regresult error_success regclosekey void tortoise registry read keys const std string basekey std vector std string keys std string s key std string s name hkey root keys 0 int root key count 0 parse registry path ensure trailing delimiter basekey root keys root key count s key s name hkey key 0 dword dw index 0 char buf 2048 dword len long reg result open key for int k 0 k root key count k if reg open key ex root keys k s key c str 0 key read key error success break key 0 if key goto cleanup do len sizeof buf reg result reg enum key ex key dw index buf len null null null null if reg result error success keys push back buf dw index while reg result error success cleanup if key 0 reg close key key tortoiseregistry readkeys skey sname rootkeys rootkeycount parseregistrypath ensuretrailingdelimiter rootkeys rootkeycount skey sname dwindex regresult rootkeycount regopenkeyex rootkeys skey c_str key_read error_success regresult regenumkeyex dwindex regresult error_success push_back dwindex regresult error_success regclosekey void tortoise registry erase key const std string name std string s key std string s name hkey root key 0 parse registry path ensure trailing delimiter name root key 0 s key s name hkey key if reg open key ex root key s key c str 0 key write key error success return ignore return value sh delete key key s name c str reg close key key tortoiseregistry erasekey skey sname rootkey parseregistrypath ensuretrailingdelimiter rootkey skey sname regopenkeyex rootkey skey c_str key_write error_success shdeletekey sname c_str regclosekey std string name std string s path path std string size type p complete relative path if s path substr 0 1 s path ensure trailing delimiter tortoise path s path if count rootkeys keys uc count 2 else rootkeys key cu else s path s path substr 1 extract root key p s path find first of if p std string npos return false std string s root key s path substr 0 p s path s path substr p 1 if s root key hkey user config if count rootkeys keys uc count 2 else rootkeys key cu else if s root key hkey classes root rootkeys key cr if count count 1 else if s root key hkey current user rootkeys key cu if count count 1 else if s root key hkey local machine rootkeys key lm if count count 1 else return false p s path find last of if p std string npos key s path name else key s path substr 0 p name s path substr p 1 return true spath size_type spath spath ensuretrailingdelimiter tortoisepath spath keys_uc key_cu spath spath spath find_first_of srootkey spath spath spath srootkey hkey_user_config keys_uc key_cu srootkey hkey_classes_root key_cr srootkey hkey_current_user key_cu srootkey hkey_local_machine key_lm spath find_last_of spath spath spath std string tortoise registry read wincvs string const std string name const std string default value hkey key long retval reg open key ex hkey current user wincvs path 0 key query value key if retval error success return default value tchar data max path dword datasize max path dword type if reg query value ex key name c str null type unsigned char data datasize error success type reg binary reg close key key return default value reg close key key return std string data tortoiseregistry readwincvsstring defaultvalue regopenkeyex hkey_current_user wincvspath key_query_value error_success defaultvalue max_path max_path regqueryvalueex c_str error_success reg_binary regclosekey defaultvalue regclosekey c init tortoise utils g osversioninfo dwos version info size sizeof g osversioninfo get version ex g osversioninfo cinittortoiseutils g_osversioninfo dwosversioninfosize g_osversioninfo getversionex g_osversioninfo bool serialized get std string x int size if get size return false char data char malloc size bool r get data size if r x assign data size free data return r preference my ghost preference 1 my ghost positive true myghostpreference myghostpositive void preference set string const std string default value my type string my string data default value setstring defaultvalue mytype mystringdata defaultvalue void preference set directory const std string default value my type dirpick my string data default value setdirectory defaultvalue mytype mystringdata defaultvalue void preference set file const std string default value const std string wild card my type filepick my string data default value my file pick wild card wild card setfile defaultvalue wildcard mytype mystringdata defaultvalue myfilepickwildcard wildcard int default value my type enumeration int my enumeration possibilities possibilities my int data default value defaultvalue mytype enumeration_int myenumerationpossibilities myintdata defaultvalue std string default value my type enumeration str key my enumeration possibilities possibilities my enumeration str keys keys my string data default value my default string data default value defaultvalue mytype enumeration_str_key myenumerationpossibilities myenumerationstrkeys mystringdata defaultvalue mydefaultstringdata defaultvalue std string default value my type enumeration iconset my enumeration possibilities possibilities my string data default value my default string data default value defaultvalue mytype enumeration_iconset myenumerationpossibilities mystringdata defaultvalue mydefaultstringdata defaultvalue void preference set boolean bool default value const std string check box text my type boolean my boolean data default value my string data check box text setboolean defaultvalue checkboxtext mytype mybooleandata defaultvalue mystringdata checkboxtext void preference set message const std string message my message message setmessage mymessage void preference set path const std string default value my type path my string data default value setpath defaultvalue mytype mystringdata defaultvalue void preference set color colorref color const std string color text my type color my color color my string data color text setcolor colortext mytype mycolor mystringdata colortext void preference set cache const std string caption my type cache my string data caption setcache mytype mystringdata void preference set ghost positive int ghost preference my ghost preference ghost preference my ghost positive true setghostpositive ghostpreference myghostpreference ghostpreference myghostpositive void preference set ghost negative int ghost preference my ghost preference ghost preference my ghost positive false setghostnegative ghostpreference myghostpreference ghostpreference myghostpositive void preference read from registry switch my type case string case dirpick case filepick my string data tortoise registry read string my registry key my string data break case enumeration int my int data tortoise registry read integer my registry key my int data break case enumeration str key my string data tortoise registry read string my registry key my default string data std vector std string iterator it my enumeration str keys begin bool b found false while it my enumeration str keys end if it my string data b found true break it if b found my string data my default string data break case enumeration iconset my string data tortoise registry read string my registry key my default string data make sure the icon set exists std vector std string iterator it my enumeration possibilities begin bool b found false while it my enumeration possibilities end if it my string data b found true break it if b found my string data my default string data break case boolean my boolean data tortoise registry read boolean my registry key my boolean data break case path std vector std string v my string data tortoise registry read vector my registry key v std vector std string iterator it v begin while it v end if my string data empty my string data my string data trim it it break case color my color tortoise registry read integer my registry key my color break case cache break readfromregistry mytype mystringdata tortoiseregistry readstring myregistrykey mystringdata enumeration_int myintdata tortoiseregistry readinteger myregistrykey myintdata enumeration_str_key mystringdata tortoiseregistry readstring myregistrykey mydefaultstringdata myenumerationstrkeys bfound myenumerationstrkeys mystringdata bfound bfound mystringdata mydefaultstringdata enumeration_iconset mystringdata tortoiseregistry readstring myregistrykey mydefaultstringdata myenumerationpossibilities bfound myenumerationpossibilities mystringdata bfound bfound mystringdata mydefaultstringdata mybooleandata tortoiseregistry readboolean myregistrykey mybooleandata mystringdata tortoiseregistry readvector myregistrykey mystringdata mystringdata mystringdata mycolor tortoiseregistry readinteger myregistrykey mycolor void preference write to registry switch my type case string case dirpick case filepick tortoise registry write string my registry key my string data break case enumeration int tortoise registry write integer my registry key my int data break case enumeration str key tortoise registry write string my registry key my string data break case enumeration iconset tortoise registry write string my registry key my string data break case boolean tortoise registry write boolean my registry key my boolean data break case path std vector std string v std string s s1 s my string data do s1 trim cut first token s if s1 empty v push back s1 while s empty tortoise registry write vector my registry key v break case color tortoise registry write integer my registry key my color case cache break writetoregistry mytype tortoiseregistry writestring myregistrykey mystringdata enumeration_int tortoiseregistry writeinteger myregistrykey myintdata enumeration_str_key tortoiseregistry writestring myregistrykey mystringdata enumeration_iconset tortoiseregistry writestring myregistrykey mystringdata tortoiseregistry writeboolean myregistrykey mybooleandata mystringdata cutfirsttoken push_back tortoiseregistry writevector myregistrykey tortoiseregistry writeinteger myregistrykey mycolor c thread locale backup c thread locale backup m locale get thread locale cthreadlocalebackup cthreadlocalebackup m_locale getthreadlocale c thread locale backup c thread locale backup set thread locale m locale cthreadlocalebackup cthreadlocalebackup setthreadlocale m_locale http snaffle http snaffle my inet null my server connection null my request null httpsnaffle httpsnaffle myinet myserverconnection myrequest bool http snaffle open const std string user agent const std string server name int port close handles my server name server name my user agent user agent my inet internet open user agent c str internet open type preconfig 0 if my inet null return false my server connection internet connect my inet server name c str port internet service http 0 unsigned long my context if my server connection null return false return true httpsnaffle useragent servername closehandles myservername servername myuseragent useragent myinet internetopen useragent c_str internet_open_type_preconfig myinet myserverconnection internetconnect myinet servername c_str internet_service_http mycontext myserverconnection bool http snaffle is open return my server connection null httpsnaffle isopen myserverconnection bool http snaffle reopen return open my user agent my server name my port httpsnaffle myuseragent myservername myport bool http snaffle start fetch std string object path under win95 http1 0 you need an initial slash if object path 0 object path std string object path nb if you consider setting internet flag pragma nocache be warned it doesn t work on a base win95 machine my request http open request my server connection null object path c str null null null mime types force a load from the server not the cache this is in case the file has changed or has been corrupted during previous transfer internet flag reload internet flag resynchronize unsigned long my context if my request null return false bool result http send request my request 0 0 0 0 if result return false return true httpsnaffle startfetch objectpath objectpath objectpath objectpath internet_flag_pragma_nocache myrequest httpopenrequest myserverconnection objectpath c_str internet_flag_reload internet_flag_resynchronize mycontext myrequest httpsendrequest myrequest int http snaffle fetch status code int length 1 dword size sizeof length dword index 0 if http query info my request http query status code http query flag number length size index return 1 return length httpsnaffle fetchstatuscode httpqueryinfo myrequest http_query_status_code http_query_flag_number std string http snaffle fetch status message char p 0 dword size 0 dword index 0 first get size http query info my request http query status text p size index then get actual data p new char size std string s if http query info my request http query status text p size index s p delete p return s httpsnaffle fetchstatusmessage httpqueryinfo myrequest http_query_status_text httpqueryinfo myrequest http_query_status_text int http snaffle fetch more std ostream out find out how much there is to download dword dw size if internet query data available my request dw size 0 0 return 1 make sure buffer is big enough my buffer resize dw size read the data dword dw downloaded if internet read file my request lpvoid my buffer 0 dw size dw downloaded return 1 see if we re done if dw downloaded 0 int status code 1 dword size sizeof status code dword index 0 if http query info my request http query status code http query flag number status code size index return 1 if status code http status ok return 1 internet close handle my request my request null return 0 write it out to a file std cout read in dw downloaded bytes std endl out write my buffer 0 dw downloaded return dw downloaded httpsnaffle fetchmore dwsize internetquerydataavailable myrequest dwsize mybuffer dwsize dwdownloaded internetreadfile myrequest mybuffer dwsize dwdownloaded dwdownloaded statuscode statuscode httpqueryinfo myrequest http_query_status_code http_query_flag_number statuscode statuscode http_status_ok internetclosehandle myrequest myrequest dwdownloaded mybuffer dwdownloaded dwdownloaded void http snaffle fetch whole file std string object path std ostream out start fetch object path int value 1 while value 0 value fetch more out httpsnaffle fetchwholefile objectpath startfetch objectpath fetchmore http snaffle http snaffle close handles httpsnaffle httpsnaffle closehandles void http snaffle close handles if my server connection internet close handle my server connection if my inet internet close handle my inet if my request internet close handle my request my inet null my server connection null my request null httpsnaffle closehandles myserverconnection internetclosehandle myserverconnection myinet internetclosehandle myinet myrequest internetclosehandle myrequest myinet myserverconnection myrequest m userdata user data m nodetype type node m_userdata userdata m_nodetype type_node file tree node node if m userdata delete m userdata filetree m_userdata m_userdata inline const file tree get file tree const return m filetree filetree getfiletree m_filetree inline const user data get user data const return m userdata userdata getuserdata m_userdata inline void set user data user data user data m userdata user data setuserdata userdata userdata m_userdata userdata inline const node type get node type const return m nodetype nodetype getnodetype m_nodetype inline const node name get name const return m name nodename getname m_name inline void set name const node name name m name name setname nodename m_name inline const node get parent const return m parent getparent m_parent inline int get id const return m id getid m_id inline void set id int id m id id setid m_id inline int get last child id const return m lastchildid getlastchildid m_lastchildid inline void set last child id int id m lastchildid id setlastchildid m_lastchildid std string file tree node get path const if m parent return ensure trailing delimiter m parent get path m parent get name else return filetree getpath m_parent ensuretrailingdelimiter m_parent getpath m_parent getname std string file tree node get path from const node node const if m parent node m parent 0 return get name else return ensure trailing delimiter m parent get path from node get name filetree getpathfrom m_parent m_parent getname ensuretrailingdelimiter m_parent getpathfrom getname std string file tree node get full name const return ensure trailing delimiter this get path get name filetree getfullname ensuretrailingdelimiter getpath getname node file tree parent name user data m nodetype type file filetree userdata m_nodetype type_file node file tree parent name user data m nodetype type dir filetree userdata m_nodetype type_dir file tree dir node dir node delete subnodes node iterator it m nodes begin while it m nodes end delete it second it filetree dirnode dirnode nodeiterator m_nodes m_nodes user data user data std string mypath path std string current name cut first path element mypath if mypath empty node must not exists assert get node current name 0 add the node node node if type type dir node new dir node m filetree this current name user data else node new file node m filetree this current name user data m nodes current name node return node else check if the node exists already node node get node current name assert node 0 node get node type type dir if node 0 add directory node node new dir node m filetree this current name 0 m nodes current name node return dir node node add node mypath type user data userdata userdata currentname cutfirstpathelement getnode currentname type_dir dirnode m_filetree currentname userdata filenode m_filetree currentname userdata m_nodes currentname getnode currentname getnodetype type_dir dirnode m_filetree currentname m_nodes currentname dirnode addnode userdata inline node get node const node name name const node map const iterator it m nodes find name if it m nodes end return 0 else return it second getnode nodename nodemap const_iterator m_nodes m_nodes inline const node iterator begin const return m nodes begin nodeiterator m_nodes inline const node iterator end const return m nodes end nodeiterator m_nodes inline bool has sub nodes const return m nodes size 0 hassubnodes m_nodes void file tree dir node get sub nodes node list node list node types node types get all my nodes node map iterator it m nodes begin file tree node node while it m nodes end node it second if node get node type node types node list push back node if node get node type type dir dir node node get sub nodes node list node types it filetree dirnode getsubnodes nodelist nodelist nodetypes nodetypes nodemap m_nodes filetree m_nodes getnodetype nodetypes nodelist push_back getnodetype type_dir dirnode getsubnodes nodelist nodetypes m rootnode 0 0 root 0 m_rootnode file tree file tree filetree filetree file tree node file tree add node const node name path node type type user data user data return m rootnode add node path type user data filetree filetree addnode nodename nodetype userdata userdata m_rootnode addnode userdata inline dir node get root return m rootnode dirnode getroot m_rootnode void file tree calc node ids int current id 0 calc node id m rootnode current id filetree calcnodeids currentid calcnodeid m_rootnode currentid inline static bool sort nodes by id node node1 node node2 return node1 get id node2 get id sortnodesbyid getid getid inline static bool sort nodes by id reverse node node1 node node2 return node1 get id node2 get id sortnodesbyidreverse getid getid void file tree calc node id node node int current id node set id current id current id process all subnodes if node get node type type dir dir node dir node dir node node node iterator it dir node begin while it dir node end calc node id it second current id it node set last child id current id 1 filetree calcnodeid currentid setid currentid currentid getnodetype type_dir dirnode dirnode dirnode nodeiterator dirnode dirnode calcnodeid currentid setlastchildid currentid my input filename c str my filename filename my line num 1 if my input good my line num 1 myinput c_str myfilename mylinenum myinput mylinenum std string crap lexer filename const return my filename craplexer myfilename int crap lexer line num const return my line num craplexer linenum mylinenum int crap lexer get tok std string token int c 0 token erase skip to first char of token while my input good c my input get if c do c my input get if c n my line num while my input good c n else if isspace c break else if c n my line num if my input eof return type finished if my input good return type err if c return handle quoted token else non quoted string slurp until whitespace or eof or error do token static cast char c c my input get while my input good isspace c if my input good my input eof my input putback static cast char c return type string return type err craplexer gettok myinput myinput myinput mylinenum myinput mylinenum myinput typefinished myinput typeerr handlequoted static_cast myinput myinput myinput myinput myinput static_cast typestring typeerr int crap lexer handle quoted std string token leading quote already removed from stream while my input good int c my input get switch c case switch my input get case token break case 0 token 0 break case token break case r token r break case n token n break case t token t break default return type err unknown ctrl char break case n return type err unexpected end of line break case return type string done break default token static cast char c break return type err read error or unexpected eof craplexer handlequoted myinput myinput myinput typeerr typeerr typestring static_cast typeerr m storagepath storage path m maxsize max size nothing else to do here m_storagepath storagepath m_maxsize maxsize const std vector std string values update lru list mark as used key std string my key key make lower case my key find and replace std string my key write values std string reg path ensure trailing delimiter m storagepath ensure trailing delimiter my key prefix tortoise registry write vector reg path values markasused mykey makelowercase mykey findandreplace mykey regpath ensuretrailingdelimiter m_storagepath ensuretrailingdelimiter mykey tortoiseregistry writevector regpath const std string value update lru list mark as used key std string my key key make lower case my key find and replace std string my key write values std string reg path ensure trailing delimiter m storagepath ensure trailing delimiter my key name tortoise registry write string reg path value markasused mykey makelowercase mykey findandreplace mykey regpath ensuretrailingdelimiter m_storagepath ensuretrailingdelimiter mykey tortoiseregistry writestring regpath std vector std string values std string my key key make lower case my key find and replace std string my key std string reg path ensure trailing delimiter m storagepath ensure trailing delimiter my key prefix tortoise registry read vector reg path values mykey makelowercase mykey findandreplace mykey regpath ensuretrailingdelimiter m_storagepath ensuretrailingdelimiter mykey tortoiseregistry readvector regpath const std string default value bool exists std string my key key make lower case my key find and replace std string my key std string reg path ensure trailing delimiter m storagepath ensure trailing delimiter my key name return tortoise registry read string reg path default value exists defaultvalue mykey makelowercase mykey findandreplace mykey regpath ensuretrailingdelimiter m_storagepath ensuretrailingdelimiter mykey tortoiseregistry readstring regpath defaultvalue void tortoise registry cache shrink std string reg path ensure trailing delimiter m storagepath lru std vector std string lru keys reg keys tortoise registry read vector reg path lru keys if lru keys size m maxsize return remove keys from lru list while lru keys size m maxsize lru keys erase lru keys end 1 store keys in map for faster access std vector std string iterator it lru keys begin std map std string bool lru map while it lru keys end lru map insert std pair std string bool it true it remove invalid keys tortoise registry read keys m storagepath reg keys std string my key while it reg keys end my key it make lower case my key if lru map find my key lru map end tortoise registry erase key my key it tortoiseregistrycache regpath ensuretrailingdelimiter m_storagepath lrukeys regkeys tortoiseregistry readvector regpath lrukeys lrukeys m_maxsize lrukeys m_maxsize lrukeys lrukeys lrukeys lrumap lrukeys lrumap tortoiseregistry readkeys m_storagepath regkeys mykey regkeys mykey makelowercase mykey lrumap mykey lrumap tortoiseregistry erasekey mykey void tortoise registry cache mark as used const std string key std string my key key make lower case my key find and replace std string my key std string reg path ensure trailing delimiter m storagepath lru std vector std string keys tortoise registry read vector reg path keys std vector std string iterator it keys begin while it keys end if it my key break it if it keys end keys erase it keys insert keys begin my key tortoise registry write vector reg path keys tortoiseregistrycache markasused mykey makelowercase mykey findandreplace mykey regpath ensuretrailingdelimiter m_storagepath tortoiseregistry readvector regpath mykey mykey tortoiseregistry writevector regpath my filename new filename myfilename newfilename cvs revisions prop sheet cvsrevisionspropsheet void cvs revisions prop sheet set hwnd hwnd new hwnd myhwnd new hwnd cvsrevisionspropsheet sethwnd newhwnd newhwnd bool cvs revisions prop sheet page proc uint u message wparam w param lparam l param switch u message case wm initdialog initialize all controls on the dialog init workfile view return true case wm command if hiword w param bn clicked return false button clicked loword w param return true case wm notify respond to notifications set window long myhwnd dwl msgresult false return true case wm destroy return true return false cvsrevisionspropsheet pageproc umessage wparam lparam umessage wm_initdialog initworkfileview wm_command wparam bn_clicked buttonclicked wparam wm_notify setwindowlong dwl_msgresult wm_destroy void cvs revisions prop sheet button clicked wparam button control id switch button control id case idc history launch tortoise act false cvs history verb my filename break case idc revisiongraph launch tortoise act false cvs revision graph verb my filename break default break todo need to assert cvsrevisionspropsheet buttonclicked buttoncontrolid buttoncontrolid idc_history launchtortoiseact cvshistoryverb myfilename idc_revisiongraph launchtortoiseact cvsrevisiongraphverb myfilename void cvs revisions prop sheet update keyword expansion controls cvs status file format fmt cvs status keyword options ko cvs status file options fo cvs status get parsed options my filename fmt ko fo set dlg item text myhwnd idc fileformat cvs status file format string fmt c str set dlg item text myhwnd idc keyword cvs status keyword options string ko c str set dlg item text myhwnd idc options cvs status file options string fo c str cvsrevisionspropsheet updatekeywordexpansioncontrols cvsstatus fileformat cvsstatus keywordoptions cvsstatus fileoptions cvsstatus getparsedoptions myfilename setdlgitemtext idc_fileformat cvsstatus fileformatstring c_str setdlgitemtext idc_keyword cvsstatus keywordoptionsstring c_str setdlgitemtext idc_options cvsstatus fileoptionsstring c_str void cvs revisions prop sheet init workfile view localisation set dlg item text myhwnd idc status h std string status c str set dlg item text myhwnd idc cvsroot h std string cvsroot c str set dlg item text myhwnd idc repository h std string repository c str set dlg item text myhwnd idc revision h std string revision c str set dlg item text myhwnd idc tag h std string sticky tag date c str set dlg item text myhwnd idc timestamp h std string revision date c str set dlg item text myhwnd idc fileformat h std string file format c str set dlg item text myhwnd idc keyword h std string keywords c str set dlg item text myhwnd idc options h std string file options c str set dlg item text myhwnd idc history history set dlg item text myhwnd idc revisiongraph revision graph show cvsroot set dlg item text myhwnd idc cvsroot cvs status cvs root for path my filename c str set dlg item text myhwnd idc repository cvs status cvs repository for path my filename c str show revision number if cvs status has revision number my filename set dlg item text myhwnd idc revision cvs status get revision number my filename c str show sticky tag or date std string sticky tag or date if cvs status has sticky tag my filename sticky tag or date cvs status get sticky tag my filename else if cvs status has sticky date my filename todo convert from cvs free format date to localized date sticky tag or date cvs status get sticky date my filename if sticky tag or date empty sticky tag or date head set dlg item text myhwnd idc tag sticky tag or date c str show timestamp if cvs status has timestamp my filename std string asc timestamp cvs status get timestamp my filename char date buf 100 if asctime to local datetimeformatted asc timestamp c str date buf sizeof date buf set dlg item text myhwnd idc timestamp date buf show file status cvs status file status status cvs status get file status recursive my filename set dlg item text myhwnd idc status cvs status file status string status c str update keyword expansion controls if is directory my filename c str show window get dlg item myhwnd idc static fileonly sw hide show window get dlg item myhwnd idc history sw hide show window get dlg item myhwnd idc revisiongraph sw hide show window get dlg item myhwnd idc revision h sw hide show window get dlg item myhwnd idc revision sw hide show window get dlg item myhwnd idc timestamp h sw hide show window get dlg item myhwnd idc timestamp sw hide show window get dlg item myhwnd idc fileformat h sw hide show window get dlg item myhwnd idc fileformat sw hide show window get dlg item myhwnd idc keyword h sw hide show window get dlg item myhwnd idc keyword sw hide show window get dlg item myhwnd idc options h sw hide show window get dlg item myhwnd idc options sw hide todo need to move this somewhere else so that focus is indeed on the history button and not on whatever is the first element on the page control presumably as set by the general property sheet framework set focus get dlg item myhwnd idc history cvsrevisionspropsheet initworkfileview setdlgitemtext idc_status_h _ c_str setdlgitemtext idc_cvsroot_h _ c_str setdlgitemtext idc_repository_h _ c_str setdlgitemtext idc_revision_h _ c_str setdlgitemtext idc_tag_h _ c_str setdlgitemtext idc_timestamp_h _ c_str setdlgitemtext idc_fileformat_h _ c_str setdlgitemtext idc_keyword_h _ c_str setdlgitemtext idc_options_h _ c_str setdlgitemtext idc_history _ setdlgitemtext idc_revisiongraph _ setdlgitemtext idc_cvsroot cvsstatus cvsrootforpath myfilename c_str setdlgitemtext idc_repository cvsstatus cvsrepositoryforpath myfilename c_str cvsstatus hasrevisionnumber myfilename setdlgitemtext idc_revision cvsstatus getrevisionnumber myfilename c_str stickytagordate cvsstatus hasstickytag myfilename stickytagordate cvsstatus getstickytag myfilename cvsstatus hasstickydate myfilename stickytagordate cvsstatus getstickydate myfilename stickytagordate stickytagordate _ setdlgitemtext idc_tag stickytagordate c_str cvsstatus hastimestamp myfilename asctimestamp cvsstatus gettimestamp myfilename datebuf asctime_to_local_datetimeformatted asctimestamp c_str datebuf datebuf setdlgitemtext idc_timestamp datebuf cvsstatus filestatus cvsstatus getfilestatusrecursive myfilename setdlgitemtext idc_status cvsstatus filestatusstring c_str updatekeywordexpansioncontrols isdirectory myfilename c_str showwindow getdlgitem idc_static_fileonly sw_hide showwindow getdlgitem idc_history sw_hide showwindow getdlgitem idc_revisiongraph sw_hide showwindow getdlgitem idc_revision_h sw_hide showwindow getdlgitem idc_revision sw_hide showwindow getdlgitem idc_timestamp_h sw_hide showwindow getdlgitem idc_timestamp sw_hide showwindow getdlgitem idc_fileformat_h sw_hide showwindow getdlgitem idc_fileformat sw_hide showwindow getdlgitem idc_keyword_h sw_hide showwindow getdlgitem idc_keyword sw_hide showwindow getdlgitem idc_options_h sw_hide showwindow getdlgitem idc_options sw_hide setfocus getdlgitem idc_history void progress dialog look busy process events todo what is the proper way of doing this with thread safe progress we don t need this function any more instead we want something akin to wait for abort wx safe yield check to see if aborted and return if my aborted return progressdialog lookbusy threadsafeprogress waitforabort wxsafeyield myaborted void progress dialog new text const std string txt text type type check to see if aborted and return if we have if my aborted return set style if type tt default wx colour colour get colour txt new text txt colour else wx colour colour switch type case tt error colour my color error break case tt warning colour my color warning break case tt noise colour my color noise break case tt updated colour my color updated break case tt conflict colour my color conflict break case tt not incvs colour my color not incvs break case tt modified colour my color modified break case tt tip colour my color tip break default assert false new text txt colour progressdialog newtext texttype myaborted ttdefault wxcolour getcolour newtext wxcolour tterror mycolorerror ttwarning mycolorwarning ttnoise mycolornoise ttupdated mycolorupdated ttconflict mycolorconflict ttnotincvs mycolornotincvs ttmodified mycolormodified tttip mycolortip newtext void progress dialog set caption const std string caption set title caption c str progressdialog setcaption settitle c_str void progress dialog set finished caption const std string caption tdebug enter progress dialog set finished caption my finished caption caption tdebug trace my finished caption progressdialog setfinishedcaption tdebug_enter progressdialog setfinishedcaption myfinishedcaption tdebug_trace myfinishedcaption bool progress dialog user aborted return my abort clicked progressdialog useraborted myabortclicked void progress dialog wait for abort tdebug enter progress dialog wait for abort if my aborted tdebug trace already aborted return and working to finished if my abort clicked tdebug trace abort clicked set title tortoisecvs aborted else tdebug trace set caption to finished set title my finished caption c str my abort enable false my ok enable true my finished true my ok set default return now closes the dialog wait for it to close while my aborted wait message msg msg while peek message msg 0 0 0 pm remove translate message msg dispatch message msg esc or enter closes the dialog if msg message wm char tchar msg w param 27 tchar msg w param 13 my aborted true some attempts to improve it while true while wx get app pending wx get app process idle a message came or no more idle processing to do wx get app do message my finished true progressdialog waitforabort tdebug_enter progressdialog waitforabort myaborted tdebug_trace myabortclicked tdebug_trace settitle _ tdebug_trace settitle myfinishedcaption c_str myabort myok myfinished myok setdefault myaborted waitmessage peekmessage pm_remove translatemessage dispatchmessage wm_char wparam wparam myaborted wxgetapp wxgetapp processidle wxgetapp domessage myfinished bool progress dialog show bool show return wx dialog show show progressdialog wxdialog void progress dialog lock bool do lock if do lock set cursor wxhourglass cursor my abort enable false else set cursor wxcursor arrow my abort enable true my can close do lock return wx window enable do lock progressdialog dolock dolock setcursor wxhourglass_cursor myabort setcursor wxcursor_arrow myabort mycanclose dolock wxwindow dolock void progress dialog synchronize wparam w param lparam l param async action aa async action w param switch aa case aa new text std pair std string progress dialog text type my pair std pair std string progress dialog text type l param new text my pair first my pair second break case aa user aborted bool b bool l param b user aborted break case aa wait for abort wait for abort break case aa show bool b bool l param b show b break case aa lock bool b l param true false lock b break default break progressdialog wparam lparam asyncaction asyncaction wparam aanewtext progressdialog texttype mypair progressdialog texttype lparam newtext mypair mypair aauseraborted lparam useraborted aawaitforabort waitforabort aashow lparam aalock lparam thread safe progress thread safe progress progress dialog forward to my forward to forward to my finished event create event 0 true false 0 threadsafeprogress threadsafeprogress progressdialog forwardto myforwardto forwardto myfinishedevent createevent thread safe progress thread safe progress close handle my finished event threadsafeprogress threadsafeprogress closehandle myfinishedevent thread safe progress thread safe progress create thread safe progress progress dialog forward to return new thread safe progress forward to threadsafeprogress threadsafeprogress createthreadsafeprogress progressdialog forwardto threadsafeprogress forwardto bool thread safe progress main handle event handle events 2 my finished event event int c 1 if event 0 c if wait with msg queue c handle events false infinite wait object 0 1 return true else reset event my finished event return false threadsafeprogress myfinishedevent waitwithmsgqueue wait_object_0 resetevent myfinishedevent void thread safe progress new text const std string txt progress dialog text type type std pair std string progress dialog text type my pair std make pair txt type synchronize wparam progress dialog aa new text lparam my pair threadsafeprogress newtext progressdialog texttype progressdialog texttype mypair make_pair progressdialog aanewtext mypair bool thread safe progress user aborted bool b result synchronize wparam progress dialog aa user aborted lparam b result return b result threadsafeprogress useraborted bresult progressdialog aauseraborted bresult bresult void thread safe progress wait for abort synchronize wparam progress dialog aa wait for abort 0 threadsafeprogress waitforabort progressdialog aawaitforabort bool thread safe progress show bool show bool b result show synchronize wparam progress dialog aa show lparam show return b result threadsafeprogress bresult progressdialog aashow bresult void thread safe progress lock bool do lock synchronize wparam progress dialog aa lock lparam do lock threadsafeprogress dolock progressdialog aalock dolock void thread safe progress finished synchronize wparam progress dialog aa finished 0 set event my finished event threadsafeprogress progressdialog aafinished setevent myfinishedevent void thread safe progress synchronize wparam w param lparam l param send message hwnd my forward to gethwnd wm sync w param l param threadsafeprogress wparam lparam sendmessage myforwardto wm_sync wparam lparam my thread safe progress 0 cvs root temp cvs root temp cvs root setcvsroot cvs root if temp cvs root allow server my server temp cvs root get server else my server localhost my directory temp cvs root get directory mythreadsafeprogress cvsroot tempcvsroot tempcvsroot cvsroot tempcvsroot allowserver myserver tempcvsroot getserver myserver mydirectory tempcvsroot getdirectory bool web log perform search std string url let user override and query if they want if is control down return perform search and query url otherwise just work it out by ourself std string url stub prefix url stub suffix if automatically findurl url stub prefix url stub suffix url make fullurl url stub prefix url stub suffix return true return false weblog performsearch iscontroldown performsearchandquery urlstubprefix urlstubsuffix automaticallyfindurl urlstubprefix urlstubsuffix makefullurl urlstubprefix urlstubsuffix bool web log perform search and query std string url tdebug enter web log perform search and query tdebug trace url url std string url stub prefix url stub suffix bool query was forced false holding down control disables the autoscan and does a query straight away if is control down query was forced true else check tortoisecvs weblog file if geturl from config file url stub prefix url stub suffix url make fullurl url stub prefix url stub suffix return true they re not holding it down so do the autoscan now if automatically findurl url stub prefix url stub suffix url make fullurl url stub prefix url stub suffix return true while true ask the user for a url give up if they cancel if query user query was forced url stub prefix url stub suffix return false query was forced false if the user chose another autoscan then do so if url stub prefix scanagain if automatically findurl url stub prefix url stub suffix url make fullurl url stub prefix url stub suffix return true else check to see if their url is ok if ishttp statusok try singleurl url stub prefix url stub suffix url make fullurl url stub prefix url stub suffix return true nothing worked so loop round to ask the user again weblog performsearchandquery tdebug_enter weblog performsearchandquery tdebug_trace urlstubprefix urlstubsuffix querywasforced iscontroldown querywasforced geturlfromconfigfile urlstubprefix urlstubsuffix makefullurl urlstubprefix urlstubsuffix automaticallyfindurl urlstubprefix urlstubsuffix makefullurl urlstubprefix urlstubsuffix queryuser querywasforced urlstubprefix urlstubsuffix querywasforced urlstubprefix automaticallyfindurl urlstubprefix urlstubsuffix makefullurl urlstubprefix urlstubsuffix ishttpstatusok trysingleurl urlstubprefix urlstubsuffix makefullurl urlstubprefix urlstubsuffix std string web log get returnedhtml return my returnedhtml weblog getreturnedhtml myreturnedhtml int web log checkurl works const std string url tdebug enter web log checkurl works if url plainlog return http status ok using http query the path on the server if we get an error i e 400 then tell the user and query for a new url stub this covers the location on the server changing url components url comp memset url comp 0 sizeof url comp char host name max path char url path max path url comp lpsz host name host name url comp dw host name length max path 1 url comp lpsz url path url path url comp dw url path length max path 1 url comp dw struct size sizeof url comp int result 0 if internet crack url url c str 0 icu decode url comp result 1000 bogus http status else http snaffle snaffler if snaffler open tortoisecvs url tester url comp lpsz host name url comp n port result 1000 if snaffler start fetch url comp lpsz url path result 1000 else result snaffler fetch status code tdebug trace checkurl works error code result if result 400 my http error url url my http error code result my http error msg snaffler fetch status message if ishttp statusok result store the data some bits of tortoisecvs parse it std ostringstream out while snaffler fetch more out 0 my returnedhtml out str viewcvs status hack result url tdebug trace checkurl works html my returnedhtml return result weblog checkurlworks tdebug_enter weblog checkurlworks http_status_ok url_components urlcomp urlcomp urlcomp hostname _max_path urlpath _max_path urlcomp lpszhostname hostname urlcomp dwhostnamelength _max_path urlcomp lpszurlpath urlpath urlcomp dwurlpathlength _max_path urlcomp dwstructsize urlcomp internetcrackurl c_str icu_decode urlcomp httpsnaffle urlcomp lpszhostname urlcomp nport startfetch urlcomp lpszurlpath fetchstatuscode tdebug_trace checkurlworks myhttperrorurl myhttperrorcode myhttperrormsg fetchstatusmessage ishttpstatusok fetchmore myreturnedhtml viewcvsstatushack tdebug_trace checkurlworks myreturnedhtml const std string directory if server find sourceforge net std string npos return std string s remove trailing delimiter directory std string size type pos s find last of if pos std string npos pos s size 1 return std string project s substr pos 1 std transform project begin project end project begin tolower return project removetrailingdelimiter size_type find_last_of int web log try singleurl const std string url stub prefix const std string url stub suffix tdebug enter web log try singleurl std string url make fullurl url stub prefix url stub suffix std string message trying url n if my thread safe progress my thread safe progress new text message tdebug trace message return checkurl works url weblog trysingleurl urlstubprefix urlstubsuffix tdebug_enter weblog trysingleurl makefullurl urlstubprefix urlstubsuffix _ mythreadsafeprogress mythreadsafeprogress newtext tdebug_trace checkurlworks void web log viewcvs status hack int result const std string url tdebug enter viewcvs status hack if my returnedhtml find http like status code std string npos tdebug trace found http like status code if my returnedhtml find 404 not found std string npos result 404 tdebug trace result result my http error url url my http error code result my http error msg 404 not found weblog viewcvsstatushack tdebug_enter viewcvsstatushack myreturnedhtml tdebug_trace myreturnedhtml tdebug_trace myhttperrorurl myhttperrorcode myhttperrormsg bool web log scan forurl std string url stub prefix std string url stub suffix tdebug enter web log scan forurl const char first part cgi bin viewcvs cvsweb bin const char second part viewcvs cgi viewcvs cvsweb cgi cvsweb pl cvsweb preprocess to get a list of prefixes to scan std vector std string prefixes std vector std string suffixes for unsigned int j 0 j sizeof second part sizeof char j for unsigned int i 0 i sizeof first part sizeof char i std string first first part i std string second second part j tdebug trace first first second second don t mix viewcvs and cvsweb parts as that is silly and unlikely if first find viewcvs std string npos second find cvsweb std string npos first find cvsweb std string npos second find viewcvs std string npos prefixes push back first second sourceforge special case add the project name into the path std string sf project source forge project my server my directory if sf project empty tdebug trace sf project sf project for unsigned int k 0 k prefixes size k prefixes k sf project else try with explicit cvsroot setting first if my directory length 0 suffixes push back cvsroot my directory substr 1 try with no suffix suffixes push back actually perform the scan bool result false std vector candidate candidates for unsigned int l 0 result l suffixes size l tdebug trace l l for unsigned int k 0 k prefixes size k url stub prefix http my server prefixes k url stub suffix suffixes l tdebug trace url stub suffix url stub suffix int statuscode try singleurl url stub prefix url stub suffix tdebug trace status statuscode http status ok if statuscode http status ok this one works stop trying more tdebug trace choosing ok url stub prefix url stub suffix result true break if my thread safe progress user aborted result false break if ishttp statusok statuscode this one might work so save it for later candidate c url stub prefix url stub suffix statuscode candidates push back c if result my thread safe progress user aborted if my thread safe progress user aborted result false if result candidates empty there were no working url s try to find one that might work with proper authentication unsigned int i for i 0 i candidates size i if candidates i statuscode http status denied url stub prefix candidates i url prefix url stub suffix candidates i url suffix tdebug trace choosing denied url stub prefix url stub suffix result true break for i 0 result i candidates size i if candidates i statuscode http status forbidden url stub prefix candidates i url prefix url stub suffix candidates i url suffix tdebug trace choosing forbidden url stub prefix url stub suffix result true break return result weblog scanforurl urlstubprefix urlstubsuffix tdebug_enter weblog scanforurl firstpart secondpart secondpart firstpart firstpart secondpart tdebug_trace push_back sfproject sourceforgeproject myserver mydirectory sfproject tdebug_trace sfproject sfproject sfproject mydirectory push_back mydirectory push_back tdebug_trace urlstubprefix myserver urlstubsuffix tdebug_trace urlstubsuffix urlstubsuffix trysingleurl urlstubprefix urlstubsuffix tdebug_trace http_status_ok http_status_ok tdebug_trace urlstubprefix urlstubsuffix mythreadsafeprogress useraborted ishttpstatusok urlstubprefix urlstubsuffix push_back mythreadsafeprogress useraborted mythreadsafeprogress useraborted http_status_denied urlstubprefix urlprefix urlstubsuffix urlsuffix tdebug_trace urlstubprefix urlstubsuffix http_status_forbidden urlstubprefix urlprefix urlstubsuffix urlsuffix tdebug_trace urlstubprefix urlstubsuffix std string web log make fullurl const std string url stub prefix const std string url stub suffix special case not a real url means do plain cvs text log locally if url stub prefix plainlog return url stub prefix attempt to canonicalize url to protect non ascii characters first get necessary buffer size std string tmp url stub prefix my ambient part url stub suffix char canonicalized url 4096 dword length sizeof canonicalized url if internet canonicalize url tmp c str canonicalized url length icu browser mode tmp canonicalized url return tmp weblog makefullurl urlstubprefix urlstubsuffix urlstubprefix urlstubprefix urlstubprefix myambientpart urlstubsuffix canonicalizedurl canonicalizedurl internetcanonicalizeurl c_str canonicalizedurl icu_browser_mode canonicalizedurl bool web log automatically findurl std string url stub prefix std string url stub suffix tdebug enter web log automatically findurl tdebug trace url stub prefix url stub prefix url stub suffix url stub suffix look for an already specified url stub for that server in the registry first try the server name cvsroot specific value url stub prefix tortoise registry read string web logurl prefix my server std string my directory if none found try the server name specific value if url stub prefix empty url stub prefix tortoise registry read string web logurl prefix my server url stub suffix tortoise registry read string web logurl suffix my server std string my directory if url stub suffix empty url stub suffix tortoise registry read string web logurl suffix my server plain cvs log is always ok if url stub prefix plainlog return true make thread to do the scanning with progress dialog in this thread my thread result false progress dialog progress if my progress dialog progress my progress dialog else progress create progress dialog my progress dialog 0 my progress dialog visible my thread safe progress new thread safe progress progress my thread prefix url stub prefix my thread suffix url stub suffix thread web log thread thread begin thread this web log thread main my thread safe progress main 0 url stub prefix my thread prefix url stub suffix my thread suffix bool result my thread result progress wait for abort for testing delete my thread safe progress if my progress dialog delete progress dialog progress my thread safe progress null if result store it in registry tortoise registry write string web logurl prefix my server std string my directory url stub prefix tortoise registry write string web logurl suffix my server std string my directory url stub suffix return result weblog automaticallyfindurl urlstubprefix urlstubsuffix tdebug_enter weblog automaticallyfindurl tdebug_trace urlstubprefix urlstubprefix urlstubsuffix urlstubsuffix urlstubprefix tortoiseregistry readstring weblogurlprefix myserver mydirectory urlstubprefix urlstubprefix tortoiseregistry readstring weblogurlprefix myserver urlstubsuffix tortoiseregistry readstring weblogurlsuffix myserver mydirectory urlstubsuffix urlstubsuffix tortoiseregistry readstring weblogurlsuffix myserver urlstubprefix mythreadresult progressdialog myprogressdialog myprogressdialog createprogressdialog myprogressdialog myprogressdialogvisible mythreadsafeprogress threadsafeprogress mythreadprefix urlstubprefix mythreadsuffix urlstubsuffix weblog beginthread weblog threadmain mythreadsafeprogress urlstubprefix mythreadprefix urlstubsuffix mythreadsuffix mythreadresult waitforabort mythreadsafeprogress myprogressdialog deleteprogressdialog mythreadsafeprogress tortoiseregistry writestring weblogurlprefix myserver mydirectory urlstubprefix tortoiseregistry writestring weblogurlsuffix myserver mydirectory urlstubsuffix bool web log query user bool query was forced std string url stub prefix std string url stub suffix work out what text to display std string message if query was forced message please enter the url where viewcvs or cv sweb is message n n else if my queried before if my http error code message printf the url s responded with error code d my http error url c str my http error code if my http error msg empty message message my http error msg message message else message sorry the url isn t responding or is responding with an error message this could happen because you are not connected to the internet because the server is down or because the path is wrong if you are behind a firewall which requires a proxy tortoisecvs is using the internet explorer proxy you might want to set it and try again n n please either try entering the url again or choose the plain text log message n n else message tortoisecvs couldn t find the url on your server where viewcvs or cv sweb is please enter the url manually message n n explain how they can work it out message you might be able to find it by browsing on the project s web site for a web interface to cvs alternatively ask your server administrator then copy the top level url into the prefix box below usually you can leave the suffix box blank it adds extra options to the end of the url todo detect this case and do something better if query was forced message this dialog can also appear if you are trying to log a file that has never been committed as a default the combo box remembers more that the user has entered url stub prefix http my server cgi bin cvsweb cgi url stub suffix bool result do log config dialog my progress dialog url stub prefix url stub suffix message my server url stub prefix remove trailing delimiter url stub prefix if url stub prefix scanagain my queried before true else my queried before false store what the user did so the next automatic scan picks it up from the registry if result tortoise registry write string web logurl prefix my server std string my directory url stub prefix tortoise registry write string web logurl suffix my server std string my directory url stub suffix return result weblog queryuser querywasforced urlstubprefix urlstubsuffix querywasforced _ cvsweb myqueriedbefore myhttperrorcode _ myhttperrorurl c_str myhttperrorcode myhttperrormsg myhttperrormsg _ _ _ cvsweb _ querywasforced _ urlstubprefix myserver urlstubsuffix dologconfigdialog myprogressdialog urlstubprefix urlstubsuffix myserver urlstubprefix removetrailingdelimiter urlstubprefix urlstubprefix myqueriedbefore myqueriedbefore tortoiseregistry writestring weblogurlprefix myserver mydirectory urlstubprefix tortoiseregistry writestring weblogurlsuffix myserver mydirectory urlstubsuffix void web log thread main tdebug enter web log thread main my thread safe progress new text std string scanning for web log url on server n n test for obsolete sourceforge registry keys it used to use a suffix std string sf project source forge project my server my directory if sf project empty tdebug trace sf project sf project if my thread suffix my thread prefix scanagain if there is a url in the registry see if it is ok first if my thread prefix empty my thread prefix scanagain tdebug trace my thread prefix my thread prefix my thread result ishttp statusok try singleurl my thread prefix my thread suffix if my thread safe progress user aborted tdebug trace user abort my thread result false my thread safe progress finished return if that doesn t work look for other values if my thread result tdebug trace scan forurl my thread result scan forurl my thread prefix my thread suffix my thread safe progress finished weblog threadmain tdebug_enter weblog threadmain mythreadsafeprogress newtext _ sfproject sourceforgeproject myserver mydirectory sfproject tdebug_trace sfproject sfproject mythreadsuffix mythreadprefix mythreadprefix mythreadprefix tdebug_trace mythreadprefix mythreadprefix mythreadresult ishttpstatusok trysingleurl mythreadprefix mythreadsuffix mythreadsafeprogress useraborted tdebug_trace mythreadresult mythreadsafeprogress mythreadresult tdebug_trace scanforurl mythreadresult scanforurl mythreadprefix mythreadsuffix mythreadsafeprogress bool web log ishttp statusok int statuscode bool ret false switch statuscode case http status ok case http status denied case http status forbidden ret true break default break return ret weblog ishttpstatusok http_status_ok http_status_denied http_status_forbidden tortoise preferences tortoise preferences fill in the details for each preference preference close if no error main progress dialog automatically close the progress window when a command completes successfully you can hold ctrl down while selecting a cvs command or as one is finishing to prevent this on a one off basis close automatically std vector std string close possibilities close possibilities push back close manually close possibilities push back close if no messages close possibilities push back close if no errors close if no error set int enumeration close possibilities 0 my prefs push back close if no error preference quietness main progress messages how detailed cvs is about what it is doing errors are always printed even at the most silent levels quietness std vector std string quietness possibilities quietness possibilities push back loud quietness possibilities push back quiet quietness possibilities push back really quiet quietness set int enumeration quietness possibilities 1 my prefs push back quietness preference icons main overlay icons the set of overlay icons tortoisecvs uses icons icons set message changes won t take effect until you log off or reboot std vector std string icon possibilities icon possibilities push back icon possibilities push back tortoisecvs tortoise registry read value names custom icons icon possibilities icons set icon set enumeration icon possibilities tortoisecvs my prefs push back icons std string calculated home directory bool got home dir get calculated home directory calculated home directory if got home dir calculated home directory failed to calculate home folder preference recalculate home advanced home folder the home folder is where the global cvsignore file is stored ssh connections also expect your ssh folder with keys and known hosts to be in your home folder n by default tortoisecvs works out a home folder for you it looks for folders in this order n an environment variable called home n wincvs specified home folder n my documents n you can turn off this automatic calculation and instead specify your own custom home folder below n currently the calculation result is calculated home directory always recalculate home recalculate home set boolean true always recalculate home folder my prefs push back recalculate home preference home directory advanced custom home folder if you turn off automatic home folder calculation you can enter an explicit path here home home directory set ghost negative my prefs size 1 home directory set directory calculated home directory my prefs push back home directory preference compression advanced network compression reduce network load by compressing traffic to and from the cvs server high levels may be slow to calculate compression level std vector std string compression possibilities compression possibilities push back 0 none compression possibilities push back 3 low compression possibilities push back 6 good compression possibilities push back 9 best compression set int enumeration compression possibilities 0 my prefs push back compression preference language main l anguage the language used in tortoisecvs dialogs and menus language iso std vector std string v lang names std vector std string v lang keys tortoise registry read value names languages v lang keys std vector std string iterator it v lang keys begin while it v lang keys end hack for chinese std string extra if it std string zh cn it std string zh tw extra gb2312 std string s lang name int lang get lang from canonical name it if lang 0 const wx language info info wx locale get language info lang if info s lang name info description c str v lang names push back s lang name extra it v lang keys insert v lang keys begin v lang names insert v lang names begin windows default language set str key enumeration v lang names v lang keys my prefs push back language exclude directories from tortoisecvs preference exclude dirs advanced excluded folders semicolon delimited list of absolute folders for which overlay icons and context menus are disabled preferences excluded directories dir exclude dirs set path my prefs push back exclude dirs include directories for tortoisecvs preference include dirs advanced included folders semicolon delimited list of absolute folders for which overlay icons and context menus are enabled an empty list enables all folders preferences included directories dir include dirs set path my prefs push back include dirs preference external diff tools diff application specify the program you use to compare files external diff application external diff set file std string executables exe bat cmd exe bat cmd my prefs push back external diff preference external diff2 params tools two way diff parameters parameters for two way diffs std string the default parameters are std string n n 1 2 n std string n 1 name of file selected for diff std string n 2 name of file selected for diff external diff2 params external diff2 params set string 1 2 my prefs push back external diff2 params if 0 not ready to use yet preference external diff3 params tools t hree way diff parameters parameters for three way diffs std string the default parameters are std string n n 1 2 n std string n 1 name of file selected for diff std string n 2 name of file selected for diff std string n 3 name of file selected for diff external diff3 params external diff3 params set string 1 2 3 my prefs push back external diff3 params endif preference external merge tools merge application specify the program you use to merge files external merge application external merge set file std string executables exe bat cmd exe bat cmd my prefs push back external merge preference external merge2 params tools two way merge parameters parameters for two way merges std string the default parameters are std string n n mine yours n std string n mine file containing my changes std string n yours file containing changes from repository external merge2 params external merge2 params set string mine yours my prefs push back external merge2 params if 0 not ready to use yet preference external merge3 params tools t hree way merge parameters parameters for three way merges std string the default parameters are std string n n mine ancestor yours n std string n mine file containing my changes std string n ancestor file containing common ancestor data std string n yours file containing changes from repository tortoisepreferences tortoisepreferences closeifnoerror _ _ _ closepossibilities closepossibilities push_back _ closepossibilities push_back _ closepossibilities push_back _ closeifnoerror setintenumeration closepossibilities myprefs push_back closeifnoerror _ _ _ quietnesspossibilities quietnesspossibilities push_back _ quietnesspossibilities push_back _ quietnesspossibilities push_back _ setintenumeration quietnesspossibilities myprefs push_back _ _ _ setmessage _ iconpossibilities iconpossibilities push_back iconpossibilities push_back tortoiseregistry readvaluenames customicons iconpossibilities seticonsetenumeration iconpossibilities myprefs push_back calculatedhomedirectory gothomedir getcalculatedhomedirectory calculatedhomedirectory gothomedir calculatedhomedirectory _ recalculatehome _ _ _ calculatedhomedirectory recalculatehome setboolean _ myprefs push_back recalculatehome homedirectory _ _ _ homedirectory setghostnegative myprefs homedirectory setdirectory calculatedhomedirectory myprefs push_back homedirectory _ _ _ compressionpossibilities compressionpossibilities push_back _ compressionpossibilities push_back _ compressionpossibilities push_back _ compressionpossibilities push_back _ setintenumeration compressionpossibilities myprefs push_back _ _ _ languageiso vlangnames vlangkeys tortoiseregistry readvaluenames vlangkeys vlangkeys vlangkeys zh_cn zh_tw slangname getlangfromcanonicalname wxlanguageinfo wxlocale getlanguageinfo slangname c_str vlangnames push_back slangname vlangkeys vlangkeys vlangnames vlangnames _ setstrkeyenumeration vlangnames vlangkeys myprefs push_back excludedirs _ _ _ excludedirs setpath myprefs push_back excludedirs includedirs _ _ _ includedirs setpath myprefs push_back includedirs externaldiff _ _ _ externaldiff setfile _ myprefs push_back externaldiff externaldiff2params _ _ _ externaldiff2params setstring myprefs push_back externaldiff2params externaldiff3params _ _ _ externaldiff3params setstring myprefs push_back externaldiff3params externalmerge _ _ _ externalmerge setfile _ myprefs push_back externalmerge externalmerge2params _ _ _ _ _ externalmerge2params setstring myprefs push_back externalmerge2params externalmerge3params _ _ _ _ _ _ tortoise preferences tortoise preferences write changed values to registry for unsigned int i 0 i my prefs size i my prefs i write to registry write appevents name tortoise registry write string hkey current user app events event labels tcvs error error tortoise registry write string hkey current user app events schemes apps tortoise act tortoisecvs write default values for app events std vector std string schemes std vector std string const iterator it tortoise registry read keys hkey current user app events schemes names schemes it schemes begin bool b exists false while it schemes end if stricmp it c str none 0 std string key hkey current user app events schemes apps tortoise act tcvs error key it tortoise registry read string key b exists if b exists tortoise registry write string key get tortoise directory tortoisecvs error wav it set current scheme std string current scheme tortoise registry read string hkey current user app events schemes if current scheme empty std string key hkey current user app events schemes apps tortoise act tcvs error current tortoise registry read string key b exists if b exists if stricmp current scheme c str none 0 tortoise registry write string key get tortoise directory tortoisecvs error wav else tortoise registry write string key tortoisepreferences tortoisepreferences myprefs myprefs writetoregistry tortoiseregistry writestring hkey_current_user appevents eventlabels tcvs_error _ tortoiseregistry writestring hkey_current_user appevents tortoiseact _ const_iterator tortoiseregistry readkeys hkey_current_user appevents bexists c_str hkey_current_user appevents tortoiseact tcvs_error tortoiseregistry readstring bexists bexists tortoiseregistry writestring gettortoisedirectory tortoisecvserror currentscheme tortoiseregistry readstring hkey_current_user appevents currentscheme hkey_current_user appevents tortoiseact tcvs_error tortoiseregistry readstring bexists bexists currentscheme c_str tortoiseregistry writestring gettortoisedirectory tortoisecvserror tortoiseregistry writestring unsigned int tortoise preferences get count return my prefs size tortoisepreferences getcount myprefs preference tortoise preferences lookup int index return my prefs index tortoisepreferences myprefs preference tortoise preferences lookup const std string reg key std vector preference iterator it my prefs begin std string s reg key reg key std string s make lower case s reg key while it my prefs end s it my registry key make lower case s if s s reg key break it return it tortoisepreferences regkey myprefs sregkey regkey makelowercase sregkey myprefs myregistrykey makelowercase sregkey const std vector std string tortoise preferences get page order const return my page order tortoisepreferences getpageorder mypageorder void tortoise preferences add page const std string page my page order push back page tortoisepreferences addpage mypageorder push_back int tortoise params parse command line char argv int argc int start int i start std string s parameter std string s value vector values vv 0 while i argc do we have a command line parameter if argv i 0 create new parameter s parameter argv i vv m params s parameter else if vv 0 add value to existing parameter s value unquote argv i vv push back s value i return i tortoiseparams parsecommandline sparameter svalue vectorvalues sparameter m_params sparameter svalue push_back svalue std string tortoise params get value const char psz param return get value psz param 0 tortoiseparams getvalue pszparam getvalue pszparam std string tortoise params get value const char psz param unsigned int index std string s result map params iterator it vector values vv 0 it m params find psz param if it m params end goto cleanup vv it second if vv size index goto cleanup s result vv index cleanup return s result tortoiseparams getvalue pszparam sresult mapparams vectorvalues m_params pszparam m_params sresult sresult bool tortoise params exists const char psz param map params iterator it it m params find psz param if it m params end return false else return true tortoiseparams pszparam mapparams m_params pszparam m_params int tortoise params get value count const char psz param int i result 0 map params iterator it vector values vv 0 it m params find psz param if it m params end goto cleanup vv it second i result vv size cleanup return i result tortoiseparams getvaluecount pszparam iresult mapparams vectorvalues m_params pszparam m_params iresult iresult std string tortoise params unquote const char psz str std string s result psz str if s result size 2 goto cleanup if s result 0 s result s result size 1 s result 0 s result s result size 1 return s result substr 1 s result size 2 cleanup return s result tortoiseparams pszstr sresult pszstr sresult sresult sresult sresult sresult sresult sresult sresult sresult sresult my do not group directories false mydonotgroupdirectories directory groups clear directorygroups inline size t size return my groups size size_t mygroups inline bool empty return my groups empty mygroups inline directory group operator unsigned int i return my groups i directorygroup mygroups inline void clear for std vector directory group iterator it my groups begin it my groups end it delete it my groups clear directorygroup mygroups mygroups mygroups inline void add directory group group my groups push back group directorygroup mygroups push_back bool directory groups preprocess file list std vector std string all files tdebug enter directory groups preprocess file list break into chunks of the same checked out sandbox for each directory store a vector of files and other data in the directory group the group has relative and absolute filenames because cvs requires relative but it is convenient for tortoisecvs to use the absolute ones when it needs to to be precise only nt server requires relative paths to a current directory unix cvs server can cope with absolute ones however it is good practice anyway clear typedef std map std string directory group directory map directory map directory map for unsigned int i 0 i all files size i std string file all files i tdebug trace file file find directory and relative filename std string directory std string relative file split file name file directory relative file tdebug trace dir directory tdebug trace relative file relative file std string key directory normal case in e cvswork test cvs update subdir put in map directory map iterator it directory map find directory directory group group 0 if it directory map end group new directory group directory map directory group group my directory directory group mycvs root cvs status cvs root for path directory group mycvs server features setcvs root group mycvs root else group it second group my entries push back new directory group entry group file relative file 0 copy into the vector for easier access by looping directory map iterator it for it directory map begin it directory map end it add it second cache single values so commands like diff can look them up easily if all files size 1 my single absolute all files 0 split file name my single absolute my single directory my single relative tdebug trace my single absolute my single absolute my preprocess cache clear return true directorygroups preprocessfilelist allfiles tdebug_enter directorygroups preprocessfilelist directorygroup _requires_ directorygroup directorymap directorymap directorymap allfiles allfiles tdebug_trace relativefile splitfilename relativefile tdebug_trace tdebug_trace relativefile directorymap directorymap directorygroup directorymap directorygroup directorymap mydirectory mycvsroot cvsstatus cvsrootforpath mycvsserverfeatures setcvsroot mycvsroot myentries push_back directorygroup relativefile directorymap directorymap directorymap allfiles mysingleabsolute allfiles splitfilename mysingleabsolute mysingledirectory mysinglerelative tdebug_trace mysingleabsolute mysingleabsolute mypreprocesscache const std string cvsroot check the cache preprocess cache iterator it my preprocess cache find directory if it my preprocess cache end return it second std string result get parent dir std string parentdir get directory above directory if parentdir directory result directory else get cvsroot for current dir std string mycvsroot if valid cvsroot mycvsroot cvsroot else if cvs directory here directory mycvsroot cvs status cvs root for path directory if we don t have a cvsroot return parent dir if mycvsroot empty result get toplevel dir parentdir else get cvsroot for parent dir std string parentcvsroot if cvs directory here parentdir parentcvsroot cvs status cvs root for path parentdir if parent dir has different or no cvsroot we ve reached the toplevel if parentcvsroot mycvsroot result directory else result get toplevel dir parentdir true parentcvsroot store dir in cache my preprocess cache directory result return result preprocesscache mypreprocesscache mypreprocesscache getdirectoryabove validcvsroot cvsdirectoryhere cvsstatus cvsrootforpath gettopleveldir cvsdirectoryhere cvsstatus cvsrootforpath gettopleveldir mypreprocesscache std string relative file std string file dir get directory part file if my do not group directories directory file dir else scan for the top level cvs directory we do everything relative to that directory get toplevel dir file dir get the relative filename if stricmp directory c str file c str 0 relative file else std string size type p directory length while file p p relative file file substr p relativefile filedir getdirectorypart mydonotgroupdirectories filedir gettopleveldir filedir c_str c_str relativefile size_type relativefile directory group directorygroup directory group for std vector entry iterator it my entries begin it my entries end it delete it directorygroup myentries myentries inline const entry operator unsigned int i const return my entries i myentries inline entry operator unsigned int i return my entries i myentries inline static bool sort entries by file name entry entry1 entry entry2 a alway comes first if entry1 my relative file entry2 my relative file return true if entry2 my relative file return false return entry1 my relative file entry2 my relative file sortentriesbyfilename myrelativefile myrelativefile myrelativefile myrelativefile myrelativefile my relative file relative file my user data user data myrelativefile relativefile myuserdata userdata virtual entry delete my user data myuserdata my entry entry myentry user data entry userdata m entry entry m_entry my remote handle 0 force flushing of preferences to registry so all values exist and defaults are as specified in tortoise preferences tortoise preferences prefs make sure that the tortoisecvs folder is in the path set env var path get env var path get tortoise directory myremotehandle tortoisepreferences tortoisepreferences setenvvar getenvvar gettortoisedirectory bool tortoise act suss args int ac char av if ac 2 do message dialog 0 too few arguments passed to tortoise act n n tortoise act is designed to be run by the explorer extension trtse shl dll you don t need to run it yourself unless you have a special purpose n n command line arguments n tortoise act cvs verb h handle f file list u url l files return false 1st arg must be verb my verb string av 1 my verb text to verb my verb string int i my parameters parse command line av ac 2 if i 1 return false if my parameters exists h std string s my parameters get value h bool valid true long my remote handle long valid sscanf s c str 0x lx my remote handle long 1 my remote handle hwnd my remote handle long if valid do message dialog 0 invalid arguments passed to tortoise act expected handle h 0xxxxxxxxx return false if my parameters exists f read filenames from a file std string s file my parameters get value f std ifstream in s file c str if in good std string message std string file containing input filenames not found n message av i do message dialog 0 message return false a file on each line while true std string file std getline in file if file empty break my all files push back file in close remove the file delete file s file c str if my parameters exists l int count my parameters get value count l for i 0 i count i my all files push back my parameters get value l i the main verbs depend on there being at least one file if verb needs files my all files empty do message dialog 0 empty file list disallowed return false check if verb needs preprocessing if verb needs preprocessing return preprocess file list else return true tortoiseact sussargs domessagedialog _ tortoiseact tortoiseact trtseshl tortoiseact myverbstring myverb texttoverb myverbstring myparameters parsecommandline myparameters myparameters getvalue myremotehandlelong c_str myremotehandlelong myremotehandle myremotehandlelong domessagedialog _ tortoiseact myparameters sfile myparameters getvalue sfile c_str _ domessagedialog myallfiles push_back deletefile sfile c_str myparameters myparameters getvaluecount myallfiles push_back myparameters getvalue verbneedsfiles myallfiles domessagedialog _ verbneedspreprocessing preprocessfilelist void tortoise act perform action switch my verb case cvs add perform add menu break case cvs add recursive perform add menu recursive break case cvs checkout perform checkout menu break case cvs tortoise code perform tortoise checkout break case cvs wx windows code performwx windows checkout break case cvs make module perform make module menu break case cvs commit dialog perform commit dialog menu break case cvs diff perform diff menu break case cvs make patch perform make patch menu break case cvs log perform log menu break case cvs release perform release menu break case cvs remove perform remove menu break case cvs restore perform restore menu break case cvs update perform update menu break case cvs update dialog perform update dialog menu break case cvs refresh status perform refresh status break case cvs web log perform web log menu break case cvs tag perform tag menu break case cvs branch perform branch menu break case cvs merge perform merge menu break case cvs help perform help break case cvs prefs perform prefs break case cvs edit perform edit break case cvs unedit perform unedit break case cvs list editors perform list editors break case cvs get perform get break case cvs history perform history break case cvs revision graph perform revision graph break case cvs about perform about break case cvs add ignore perform add ignore break case cvs add ignore ext perform add ignore true break case cvs resolve conflicts perform resolve conflicts break case cvs merge conflicts perform merge conflicts break case cvs url perform url case cvs rebuild icons perform rebuild icons break case cvs save as perform save as break case cvs annotate perform annotate break default do message dialog 0 std string unknown verb n my verb string break tortoiseact performaction myverb cvsadd performaddmenu cvsaddrecursive performaddmenurecursive cvscheckout performcheckoutmenu cvstortoisecode performtortoisecheckout cvswxwindowscode performwxwindowscheckout cvsmakemodule performmakemodulemenu cvscommitdialog performcommitdialogmenu cvsdiff performdiffmenu cvsmakepatch performmakepatchmenu cvslog performlogmenu cvsrelease performreleasemenu cvsremove performremovemenu cvsrestore performrestoremenu cvsupdate performupdatemenu cvsupdatedialog performupdatedialogmenu cvsrefreshstatus performrefreshstatus cvsweblog performweblogmenu cvstag performtagmenu cvsbranch performbranchmenu cvsmerge performmergemenu cvshelp performhelp cvsprefs performprefs cvsedit performedit cvsunedit performunedit cvslisteditors performlisteditors cvsget performget cvshistory performhistory cvsrevisiongraph performrevisiongraph cvsabout performabout cvsaddignore performaddignore cvsaddignoreext performaddignore cvsresolveconflicts performresolveconflicts cvsmergeconflicts performmergeconflicts cvsurl performurl cvsrebuildicons performrebuildicons cvssaveas performsaveas cvsannotate performannotate domessagedialog _ myverbstring void tortoise act perform add menu tdebug enter tortoise act perform add menu create add files data for each selected file unsigned int i j for i 0 i my directory groups size i directory group group my directory groups i for j 0 j group size j directory group add files data data new directory group add files data group j tdebug trace file group j my absolute file group j my user data data data my selected true if do add files dialog 0 my directory groups add files tortoiseact performaddmenu tdebug_enter tortoiseact performaddmenu addfiles mydirectorygroups directorygroup mydirectorygroups directorygroup addfilesdata directorygroup addfilesdata tdebug_trace myabsolutefile myuserdata myselected doaddfilesdialog mydirectorygroups addfiles void tortoise act add files tdebug enter tortoise act add files cvs action glue 0 bool ok true file tree tree 0 std vector std string files to commit my all files clear glue set progress finished caption printf finished add in s get dir list c str for unsigned int j 0 j my directory groups size j directory group group my directory groups j remove deselected entries std vector directory group entry entries directory group entry entry directory group add files data add files data std vector directory group entry iterator it entries group my entries begin entries reserve group my entries size copy all selected entries to new temporary vector while it entries group my entries end entry it entries add files data directory group add files data entry my user data if add files data my selected entries push back entry else delete entry it entries put entries back into group s my entries group my entries entries if no entries are selected continue with next group if group my entries size 0 continue parse list into a tree tree build file tree directory group entry tree data group 0 get a list of all directory nodes in the tree file tree node list dir nodes dir nodes push back tree get root tree get root get sub nodes dir nodes file tree type dir process each directory file tree node list iterator it dir nodes dir nodes begin file tree dir node dir node file tree node node directory group entry tree data entry tree data while it dir nodes dir nodes end dir node file tree dir node it dir nodes std map std string std vector std string files group subnodes by k flag file tree node iterator it nodes dir node begin while it nodes dir node end node it nodes second entry tree data directory group entry tree data node get user data if entry tree data directory group entry entry entry tree data m entry add files data directory group add files data entry my user data assert add files data special handling for directories std string kflags if node get node type file tree type dir kflags cvs status build add flags add files data my file format add files data my keyword options add files data my file options files to commit push back entry my absolute file files kflags push back node get name it nodes add files in batches sorted by kflag std map std string std vector std string iterator it files files begin while it files files end std vector std string add files it files second std string kflags it files first add files and directories std string dir dir node get full name glue set progress caption printf adding in s dir c str if add files empty make args args args add option add if kflags empty args add option std string k kflags for unsigned int i 0 i add files size i args add arg add files i ok ok glue command dir args if ok goto cleanup it files on to the next node it dir nodes delete tree tree 0 commit files if tortoise registry read boolean automatic commit false files to commit empty ok std vector std string modified removed empty cvs action pglue glue ok do commit modified files to commit removed pglue if ok goto cleanup cleanup if tree delete tree if glue at least one success refresh explorer window tortoiseact addfiles tdebug_enter tortoiseact addfiles cvsaction filetree filestocommit myallfiles setprogressfinishedcaption _ getdirlist c_str mydirectorygroups directorygroup mydirectorygroups directorygroup directorygroup directorygroup addfilesdata addfilesdata directorygroup itentries myentries myentries itentries myentries itentries addfilesdata directorygroup addfilesdata myuserdata addfilesdata myselected push_back itentries myentries myentries myentries buildfiletree directorygroup entrytreedata filetree nodelist dirnodes dirnodes push_back getroot getroot getsubnodes dirnodes filetree type_dir filetree nodelist itdirnodes dirnodes filetree dirnode dirnode filetree directorygroup entrytreedata entrytreedata itdirnodes dirnodes dirnode filetree dirnode itdirnodes filetree nodeiterator itnodes dirnode itnodes dirnode itnodes entrytreedata directorygroup entrytreedata getuserdata entrytreedata directorygroup entrytreedata m_entry addfilesdata directorygroup addfilesdata myuserdata addfilesdata getnodetype filetree type_dir cvsstatus buildaddflags addfilesdata myfileformat addfilesdata mykeywordoptions addfilesdata myfileoptions filestocommit push_back myabsolutefile push_back getname itnodes itfiles itfiles addfiles itfiles itfiles dirnode getfullname setprogresscaption _ c_str addfiles makeargs add_option add_option addfiles add_arg addfiles itfiles itdirnodes tortoiseregistry readboolean filestocommit cvsaction docommit filestocommit atleastonesuccess refreshexplorerwindow void tortoise act perform add menu recursive tdebug enter tortoise act perform add menu recursive get all files that need adding recursively get addable files true if my all files empty do message dialog 0 there is nothing to add n n all the files folders and their contents that you selected are already in cvs or are specified in a cvsignore file return query the user if do add files dialog 0 my directory groups add files tortoiseact performaddmenurecursive tdebug_enter tortoiseact performaddmenurecursive getaddablefiles myallfiles domessagedialog _ doaddfilesdialog mydirectorygroups addfiles void tortoise act perform checkout menu only allow one directory if my directory groups my single absolute empty return if is directory my directory groups my single absolute c str return cvs root cvs root std string module tag date alternate directory bool export mode false unix line endings false bool force head tortoise registry read boolean force head revision false if my parameters exists q if do checkout dialog 0 cvs root module tag date export mode alternate directory unix line endings my directory groups my single absolute force head return else cvs root setcvsroot my parameters get value cvsroot module my parameters get value module tag my parameters get value tag date my parameters get value date cvs action glue 0 glue set progress finished caption printf finished checkout in s my directory groups my single absolute c str glue setcvs root cvs root make args args if export mode args add option export if date empty args add option r args add option tag empty std string head tag else args add option checkout if tag empty tag head args add option r args add option tag empty std string head tag if date empty args add option d args add option date if alternate directory empty args add option d args add option alternate directory if unix line endings args add global option lf if export mode if tortoise registry read boolean prune empty directories true args add option p if force head args add option f args add option module glue set progress caption printf checking out in s my directory groups my single absolute c str if export mode tag empty glue get progress dialog new text std string no tag specified for export using head n n progress dialog tt warning bool ok glue command my directory groups my single absolute args tortoise registry write boolean failed module page ok tortoiseact performcheckoutmenu mydirectorygroups mysingleabsolute isdirectory mydirectorygroups mysingleabsolute c_str cvsroot cvsroot alternatedirectory exportmode unixlineendings forcehead tortoiseregistry readboolean myparameters docheckoutdialog cvsroot exportmode alternatedirectory unixlineendings mydirectorygroups mysingleabsolute forcehead cvsroot myparameters getvalue myparameters getvalue myparameters getvalue myparameters getvalue cvsaction setprogressfinishedcaption _ mydirectorygroups mysingleabsolute c_str setcvsroot cvsroot makeargs exportmode add_option add_option add_option add_option add_option add_option add_option add_option alternatedirectory add_option add_option alternatedirectory unixlineendings add_global_option exportmode tortoiseregistry readboolean add_option forcehead add_option add_option setprogresscaption _ mydirectorygroups mysingleabsolute c_str exportmode getprogressdialog newtext _ progressdialog ttwarning mydirectorygroups mysingleabsolute tortoiseregistry writeboolean failedmodulepage void tortoise act perform tortoise checkout std string project tortoisecvs std string module tortoisecvs only allow one directory if my directory groups my single absolute empty return if is directory my directory groups my single absolute c str return cvs action glue 0 glue set progress finished caption printf finished checkout in s my directory groups my single absolute c str cvs root cvs root cvs root set protocol pserver cvs root set user anonymous cvs root set server cvs sourceforge net cvs root set directory cvsroot project glue setcvs root cvs root password is empty string for sourceforge make args args args add option z3 args add option checkout args add option p args add arg module glue set progress caption printf checking out in s my directory groups my single absolute c str if glue command my directory groups my single absolute args std string message you can now compile the tortoisecvs code it will use a precompiled set of wx widgets libraries unless you also fetch the wx widgets code message n n message create a patch file if you fix some bugs or add some new features please submit the changes for other users right click on the changed files or folders and choose make patch from the cvs submenu glue get progress dialog new text message tortoiseact performtortoisecheckout mydirectorygroups mysingleabsolute isdirectory mydirectorygroups mysingleabsolute c_str cvsaction setprogressfinishedcaption _ mydirectorygroups mysingleabsolute c_str cvsroot cvsroot cvsroot setprotocol cvsroot setuser cvsroot setserver cvsroot setdirectory setcvsroot cvsroot makeargs add_option add_option add_option add_arg setprogresscaption _ mydirectorygroups mysingleabsolute c_str mydirectorygroups mysingleabsolute _ wxwidgets wxwidgets _ getprogressdialog newtext void tortoise act performwx windows checkout only allow one directory if my directory groups my single absolute empty return if is directory my directory groups my single absolute c str return cvs action glue 0 glue set progress finished caption printf finished checkout in s my directory groups my single absolute c str cvs root cvs root cvs root set protocol pserver cvs root set user anoncvs cvs root set server cvs wxwindows org cvs root set directory pack cvsroots wxwindows glue setcvs root cvs root glue set password anoncvs make args args args add option login glue set progress caption printf logging in in s my directory groups my single absolute c str if glue command my directory groups my single absolute args return glue setcvs root cvs root make args args args add option checkout args add option wx windows glue set progress caption printf checking out in s my directory groups my single absolute c str if glue command my directory groups my single absolute args return see if we need to make the setup file std string setup dir my directory groups my single absolute wx windows include wx msw std string setup source setup dir setup0 h std string setup dest setup dir setup h if file exists setup source c str std string message printf no template setup file to copy from s setup source c str n glue get progress dialog new text message return if file exists setup dest c str std string message printf patched setup file already exists s setup dest c str n glue get progress dialog new text message return do it with patching std string message std string patching setup file n glue get progress dialog new text message int patch count 0 std ifstream in setup source c str std ofstream out setup dest c str out tortoisecvs copied and patched this file n out see comments below for details n n while in eof std string line std getline in line if line define wxuse debug new always 1 out n patched by tortoisecvs n out line n out define wxuse debug new always 0 n patch count else if line define wxuse memory tracing 1 out n patched by tortoisecvs n out line n out define wxuse memory tracing 0 n patch count else if line define wxuse global memory operators 1 out n patched by tortoisecvs n out line n out define wxuse global memory operators 0 n patch count else out line n if patch count 3 message everything completed ok else message warning exactly three patches were not applied message n n message you can now compile the wx widgets code if the tortoisecvs code folder is within the same folder as the wx widgets code the tortoisecvs visual c project will automatically find the wx widgets one message n n message create a patch file if you fix some bugs or add some new features please submit the changes for other users right click on the changed files or folders and choose make patch from the cvs submenu glue get progress dialog new text message tortoiseact performwxwindowscheckout mydirectorygroups mysingleabsolute isdirectory mydirectorygroups mysingleabsolute c_str cvsaction setprogressfinishedcaption _ mydirectorygroups mysingleabsolute c_str cvsroot cvsroot cvsroot setprotocol cvsroot setuser cvsroot setserver cvsroot setdirectory setcvsroot cvsroot setpassword makeargs add_option setprogresscaption _ mydirectorygroups mysingleabsolute c_str mydirectorygroups mysingleabsolute setcvsroot cvsroot makeargs add_option add_option wxwindows setprogresscaption _ mydirectorygroups mysingleabsolute c_str mydirectorygroups mysingleabsolute setupdir mydirectorygroups mysingleabsolute wxwindows setupsource setupdir setupdest setupdir fileexists setupsource c_str _ setupsource c_str getprogressdialog newtext fileexists setupdest c_str _ setupdest c_str getprogressdialog newtext _ getprogressdialog newtext patchcount setupsource c_str setupdest c_str _ _ wxuse_debug_new_always _ wxuse_debug_new_always patchcount wxuse_memory_tracing _ wxuse_memory_tracing patchcount wxuse_global_memory_operators _ wxuse_global_memory_operators patchcount patchcount _ _ _ wxwidgets wxwidgets wxwidgets _ getprogressdialog newtext void tortoise act perform make module menu only allow one directory which isn t in cvs already if my directory groups my single absolute empty return if is directory my directory groups my single absolute c str return if cvs directory here my directory groups my single absolute return fetch parameters std string module extract last part my directory groups my single absolute cvs root cvs root bool watchon std string comment if do make module dialog 0 cvs root module watchon comment return tortoise registry write boolean failed module page true get temporary dir to work in std string temp dir get temporary path temp dir ensure trailing delimiter temp dir temp dir tortoisecvs make new module temp temp dir ensure trailing delimiter temp dir delete directory recursively temp dir create directory temp dir c str null import that directory bool ok cvs action glue 0 glue set progress finished caption printf finished make new module in s my directory groups my single absolute c str glue setcvs root cvs root make args args args add option import args add option m args add option comment args add option module args add option tcvs vendor args add option tcvs release glue set progress caption importing ok glue command temp dir args now we can remove it remove directory temp dir c str give up if we failed the import if ok goto cleanup check out on top of the original glue setcvs root cvs root make args args args add option checkout args add option d args add option extract last part my directory groups my single absolute args add option module glue set progress caption checking out if glue command get directory above my directory groups my single absolute args goto cleanup if watchon set watch on for the new module this will apply to all files added in the future make args args args add option watch args add option on glue set progress caption enabling watch if glue command my directory groups my single absolute args goto cleanup tortoise registry write boolean failed module page false glue get progress dialog new text tortoise tip the top level folder has now been created in cvs n to add files and subfolders invoke the cvs add contents command progress dialog tt tip cleanup refresh explorer window tortoiseact performmakemodulemenu mydirectorygroups mysingleabsolute isdirectory mydirectorygroups mysingleabsolute c_str cvsdirectoryhere mydirectorygroups mysingleabsolute extractlastpart mydirectorygroups mysingleabsolute cvsroot cvsroot domakemoduledialog cvsroot tortoiseregistry writeboolean failedmodulepage tempdir gettemporarypath tempdir ensuretrailingdelimiter tempdir tempdir tempdir ensuretrailingdelimiter tempdir deletedirectoryrecursively tempdir createdirectory tempdir c_str cvsaction setprogressfinishedcaption _ mydirectorygroups mysingleabsolute c_str setcvsroot cvsroot makeargs add_option add_option add_option add_option add_option add_option setprogresscaption _ tempdir removedirectory tempdir c_str setcvsroot cvsroot makeargs add_option add_option add_option extractlastpart mydirectorygroups mysingleabsolute add_option setprogresscaption _ getdirectoryabove mydirectorygroups mysingleabsolute makeargs add_option add_option setprogresscaption _ mydirectorygroups mysingleabsolute tortoiseregistry writeboolean failedmodulepage getprogressdialog newtext _ progressdialog tttip refreshexplorerwindow void tortoise act perform commit dialog menu tdebug enter tortoise act perform commit dialog menu if automatic unedit is enabled we need a list of writable files bool auto unedit tortoise registry read boolean automatic unedit false get a list of all the modified added removed files std vector std string modified added removed unmodified writable for unsigned int i 0 i my all files size i cvs status recursive scan my all files i modified added removed unmodified auto unedit writable 0 0 tdebug trace modified modified size added added size removed removed size unmodified unmodified size if auto unedit tdebug trace writable writable size sort them into order std sort modified begin modified end std sort added begin added end std sort removed begin removed end std sort unmodified begin unmodified end if auto unedit std sort writable begin writable end check there are some files if modified empty added empty removed empty auto unedit writable empty do message dialog 0 there is nothing to commit n n all the files and folders that you selected are unchanged since you last performed a commit return bool ok true cvs action pglue 0 try to determine if watch is off for this module bool is watch on auto unedit if modified empty added empty removed empty ok do commit modified added removed pglue is watch on if auto unedit is watch on auto unedit false if ok auto unedit check there are some writable files if writable empty redo the preprocessing into groups my all files writable if preprocess file list todo better error code everywhere tortoise fatal error failed to reprocess file list bool ok true if pglue pglue new cvs action 0 for unsigned int j 0 j my directory groups size j directory group group my directory groups j make args args args add option unedit for unsigned int i 0 i group size i args add arg group i my relative file if pglue command group my directory args ok false clear the explorer window unless it was all directories being updated in which case no point if file selected pglue pglue at least one success refresh explorer window delete pglue tortoiseact performcommitdialogmenu tdebug_enter tortoiseact performcommitdialogmenu autounedit tortoiseregistry readboolean myallfiles cvsstatus recursivescan myallfiles autounedit tdebug_trace autounedit tdebug_trace autounedit autounedit domessagedialog _ cvsaction iswatchon autounedit docommit iswatchon autounedit iswatchon autounedit autounedit myallfiles preprocessfilelist tortoisefatalerror _ cvsaction mydirectorygroups directorygroup mydirectorygroups makeargs add_option add_arg myrelativefile mydirectory fileselected atleastonesuccess refreshexplorerwindow void tortoise act perform diff menu tdebug enter tortoise act perform diff menu forget the diff program if the user holds down control so they can choose a new diff program bool force query false if is control down force query true std string rev1 rev2 if my parameters get value count r 0 not just diffing against head revision rev1 my parameters get value r 0 rev2 my parameters get value r 1 do diff my directory groups rev1 rev2 force query tortoiseact performdiffmenu tdebug_enter tortoiseact performdiffmenu forcequery iscontroldown forcequery myparameters getvaluecount myparameters getvalue myparameters getvalue dodiff mydirectorygroups forcequery void tortoise act perform make patch menu make patch file in temporary place std string temp filename unique temporary file bool got dirs false std string patch filename cvs action glue 0 glue set progress finished caption printf finished making patch in s get dir list c str glue set stream file temp filename glue set close ifok true for unsigned int j 0 j my directory groups size j directory group group my directory groups j if patch filename empty patch filename patch filename extract last part group my directory make args args args add option diff args add option u for unsigned int i 0 i group size i const std string rel file group i my relative file args add arg rel file if rel file empty rel file got dirs true glue set progress caption printf making patch in s group my directory c str if glue command group my directory args return if my all files size 1 patch filename extract last part my directory groups my single absolute patch filename patch see if any changes were made if file exists temp filename c str do message dialog 0 there are no patches n n all the files and folders that you selected are unchanged since you last performed a commit return get all files that need adding recursively get addable files false query where to save the file std stringstream ss filter ss filter patch files patch patch text files txt txt all files std vector std string added files std vector std string added absolute files patch filename do save file dialog 0 save patch file patch filename ss filter str added files added absolute files got dirs my directory groups 0 if patch filename empty return now append the patches for the added files std ofstream os temp filename c str std ios app for size t i 0 i added files size i std string filename added files i find and replace filename std string std string os filename std endl os filename std endl read in file counting of lines int number of lines 0 std ifstream is added absolute files i c str std string file contents while 1 std string line if std getline is line line empty break number of lines file contents file contents line file contents r n os 0 0 1 number of lines std endl os file contents std endl os close finally move the file into place delete file patch filename c str move file temp filename c str patch filename c str launch it so the user can check it seems ok std string command get text editor command patch filename c str launch command command false tortoiseact performmakepatchmenu tempfilename uniquetemporaryfile gotdirs patchfilename cvsaction setprogressfinishedcaption _ getdirlist c_str setstreamfile tempfilename setcloseifok mydirectorygroups directorygroup mydirectorygroups patchfilename patchfilename patchfilename extractlastpart mydirectory makeargs add_option add_option relfile myrelativefile add_arg relfile relfile relfile gotdirs setprogresscaption _ mydirectory c_str mydirectory myallfiles patchfilename extractlastpart mydirectorygroups mysingleabsolute patchfilename fileexists tempfilename c_str domessagedialog _ getaddablefiles ssfilter ssfilter _ _ _ addedfiles addedabsolutefiles patchfilename dosavefiledialog _ patchfilename ssfilter addedfiles addedabsolutefiles gotdirs mydirectorygroups patchfilename tempfilename c_str size_t addedfiles addedfiles findandreplace numberoflines addedabsolutefiles c_str filecontents numberoflines filecontents filecontents filecontents numberoflines filecontents deletefile patchfilename c_str movefile tempfilename c_str patchfilename c_str gettexteditorcommand patchfilename c_str launchcommand void tortoise act perform log menu cvs action glue 0 glue set progress finished caption printf finished log in s get dir list c str glue set close cvs action close never for unsigned int j 0 j my directory groups size j directory group group my directory groups j make args args args add option log for unsigned int i 0 i group size i cvs status file status status cvs status get file status group i my absolute file if status cvs status status incvs ro status cvs status status incvs rw status cvs status status added status cvs status status changed status cvs status status conflict args add arg group i my relative file glue set progress caption printf logging in s group my directory c str if glue command group my directory args return tortoiseact performlogmenu cvsaction setprogressfinishedcaption _ getdirlist c_str setclose cvsaction closenever mydirectorygroups directorygroup mydirectorygroups makeargs add_option cvsstatus filestatus cvsstatus getfilestatus myabsolutefile cvsstatus status_incvs_ro cvsstatus status_incvs_rw cvsstatus status_added cvsstatus status_changed cvsstatus status_conflict add_arg myrelativefile setprogresscaption _ mydirectory c_str mydirectory void tortoise act perform release menu if do release dialog 0 my all files refresh explorer window tortoiseact performreleasemenu doreleasedialog myallfiles refreshexplorerwindow void tortoise act perform remove menu tdebug enter tortoise act perform remove menu cvs action glue 0 my directory groups my do not group directories true preprocess file list glue set progress finished caption printf finished remove in s get dir list c str unsigned int i j std vector std string new files get current size of recycle bin shqueryrbinfo sh queryrb info sh queryrb info cb size sizeof sh queryrb info int64 recycle bin size 0 if sh query recycle bin my directory groups 0 my directory c str sh queryrb info s ok recycle bin size sh queryrb info i64 size tdebug trace recycle bin size for j 0 j my directory groups size j directory group group my directory groups j for i 0 i group size i if is directory group i my absolute file c str tdebug trace directory group i my absolute file std vector std string added modified unmodified cvs status recursive scan group i my absolute file modified added 0 unmodified 0 modified new files insert new files end modified begin modified end new files insert new files end added begin added end new files insert new files end unmodified begin unmodified end else tdebug trace file group i my absolute file new files push back group i my absolute file typedef std set std string less nocase dup set dup set my set tdebug trace remove duplicate files remove duplicate entries for i 0 i new files size i tdebug trace file new files i my set insert new files i dup set iterator it my set begin my all files clear tdebug trace readd files while it my set end tdebug trace file it my all files push back it it my set clear if my all files empty do message dialog glue get progress dialog std string no files found that could be removed preprocess file list bool result true int total file count 0 for j 0 j my directory groups size j directory group group my directory groups j tdebug trace group group my directory bool readonly false make args texteditargs texteditargs add option edit texteditargs add option z bool do text false make args binaryeditargs binaryeditargs add option edit binaryeditargs add option z binaryeditargs add option c bool do binary false do a cvs edit on any read only files std vector std string changed files for i 0 i group size i if is file removable group i my absolute file check if the file has changed cvs status file status status cvs status get file status group i my absolute file if status cvs status status changed status cvs status status conflict changed files push back group i my absolute file std string file group i my absolute file if is read only file c str readonly true if cvs status is binary file do binary true binaryeditargs add arg group i my relative file else do text true texteditargs add arg group i my relative file if changed files empty std stringstream changed files list std ostream iterator std string it changed files list n std copy changed files begin changed files end it const char p changed files size 1 the file n n s nis modified are you sure that you want to remove it and thus lose your changes the files n n s nare modified are you sure that you want to remove them and thus lose your changes if do yes no dialog glue get progress dialog printf p changed files list str c str false break if readonly do cvs edit first glue set progress caption printf editing in s group my directory c str if do text glue command group my directory texteditargs if glue at least one success refresh explorer window return if do binary glue command group my directory binaryeditargs if glue at least one success refresh explorer window return construct command and move all the files out of the way tdebug trace removing files glue set progress caption printf removing in s group my directory c str make args args args add option remove int file count 0 for i 0 i group size i if is directory group i my absolute file c str continue tdebug trace file group i my absolute file if is file removable group i my absolute file std string file group i my absolute file std string file moved file tortoise removed move the file out of the way if move file file c str file moved c str tdebug trace error moving file file do message dialog glue get progress dialog printf couldn t rename file n s to s file c str file moved c str result false break file count total file count args add arg group i my relative file if result return if file count 0 continue result glue command group my directory args if result return check for conflicts caused by a file having been removed by second party std string out glue get std out std vector std string conflict files parse conflicts group out conflict files for i 0 i conflict files size i rename the file back std string file conflict files i std string file moved file tortoise removed if move file file moved c str file c str tdebug trace error moving file back file do message dialog glue get progress dialog printf couldn t rename file back n s to s file moved c str file c str cvs status invalidate cache tdebug trace recycling files std ostringstream ss files for i 0 i group size i if is directory group i my absolute file c str continue tdebug trace file group i my absolute file cvs status file status status cvs status get file status group i my absolute file rename the file back std string file group i my absolute file std string file moved file tortoise removed if move file file moved c str file c str tdebug trace error moving file file do message dialog glue get progress dialog printf couldn t rename file back n s to s file moved c str file c str if status cvs status status removed ss files file n if ss files str length 0 cvs remove was succesful move the file to recycle bin shfileopstruct fileop fileop hwnd my remote handle fileop w func fo delete int len ss files str length char p char malloc len 1 memcpy p ss files str c str len 1 int i for i 0 i len i if p i n p i 0 fileop p from p fileop p to 0l fileop f flags fof allowundo fof silent fof noconfirmation if sh file operation fileop 0 do message dialog glue get progress dialog couldn t recycle free p if total file count 0 glue get progress dialog new text no removable files found if recycle bin is enabled i e if its size has changed show tip if sh query recycle bin my directory groups 0 my directory c str sh queryrb info s ok sh queryrb info i64 size recycle bin size glue get progress dialog new text tortoise tip any removed files have been moved to the recycle bin n you can undo the remove by restoring the file from the recycle bin and doing a cvs add progress dialog tt tip else tdebug trace recycling didn t work if glue at least one success refresh explorer window tortoiseact performremovemenu tdebug_enter tortoiseact performremovemenu cvsaction mydirectorygroups mydonotgroupdirectories preprocessfilelist setprogressfinishedcaption _ getdirlist c_str newfiles shqueryrbinfo shqueryrbinfo cbsize shqueryrbinfo __int64 recyclebinsize shqueryrecyclebin mydirectorygroups mydirectory c_str shqueryrbinfo s_ok recyclebinsize shqueryrbinfo i64size tdebug_trace recyclebinsize mydirectorygroups directorygroup mydirectorygroups isdirectory myabsolutefile c_str tdebug_trace myabsolutefile cvsstatus recursivescan myabsolutefile newfiles newfiles newfiles newfiles newfiles newfiles tdebug_trace myabsolutefile newfiles push_back myabsolutefile less_nocase dupset dupset myset tdebug_trace newfiles tdebug_trace newfiles myset newfiles dupset myset myallfiles tdebug_trace myset tdebug_trace myallfiles push_back myset myallfiles domessagedialog getprogressdialog _ preprocessfilelist totalfilecount mydirectorygroups directorygroup mydirectorygroups tdebug_trace mydirectory makeargs add_option add_option dotext makeargs add_option add_option add_option dobinary changedfiles isfileremovable myabsolutefile cvsstatus filestatus cvsstatus getfilestatus myabsolutefile cvsstatus status_changed cvsstatus status_conflict changedfiles push_back myabsolutefile myabsolutefile isreadonly c_str cvsstatus isbinary dobinary add_arg myrelativefile dotext add_arg myrelativefile changedfiles changedfileslist ostream_iterator changedfileslist changedfiles changedfiles changedfiles doyesnodialog getprogressdialog _ changedfileslist c_str setprogresscaption _ mydirectory c_str dotext mydirectory atleastonesuccess refreshexplorerwindow dobinary mydirectory atleastonesuccess refreshexplorerwindow tdebug_trace setprogresscaption _ mydirectory c_str makeargs add_option filecount isdirectory myabsolutefile c_str tdebug_trace myabsolutefile isfileremovable myabsolutefile myabsolutefile filemoved movefile c_str filemoved c_str tdebug_trace domessagedialog getprogressdialog _ c_str filemoved c_str filecount totalfilecount add_arg myrelativefile filecount mydirectory getstdout conflictfiles parseconflicts conflictfiles conflictfiles conflictfiles filemoved movefile filemoved c_str c_str tdebug_trace domessagedialog getprogressdialog _ filemoved c_str c_str cvsstatus invalidatecache tdebug_trace ssfiles isdirectory myabsolutefile c_str tdebug_trace myabsolutefile cvsstatus filestatus cvsstatus getfilestatus myabsolutefile myabsolutefile filemoved movefile filemoved c_str c_str tdebug_trace domessagedialog getprogressdialog _ filemoved c_str c_str cvsstatus status_removed ssfiles ssfiles myremotehandle wfunc fo_delete ssfiles ssfiles c_str pfrom pto fflags fof_allowundo fof_silent fof_noconfirmation shfileoperation domessagedialog getprogressdialog totalfilecount getprogressdialog newtext _ shqueryrecyclebin mydirectorygroups mydirectory c_str shqueryrbinfo s_ok shqueryrbinfo i64size recyclebinsize getprogressdialog newtext _ progressdialog tttip tdebug_trace atleastonesuccess refreshexplorerwindow void tortoise act perform restore menu cvs action glue 0 bool ok true unsigned int j file tree tree 0 glue set progress finished caption printf finished restoring in s get dir list c str for j 0 j my directory groups size j directory group group my directory groups j parse list into a tree tree build file tree directory group entry tree data group 0 get a list of all directory nodes in the tree file tree node list dir nodes dir nodes push back tree get root tree get root get sub nodes dir nodes file tree type dir process each directory file tree node list iterator it dir nodes dir nodes begin file tree dir node dir node file tree node node directory group entry tree data entry tree data while it dir nodes dir nodes end dir node file tree dir node it dir nodes std vector std string files group files file tree node iterator it nodes dir node begin while it nodes dir node end node it nodes second entry tree data directory group entry tree data node get user data if entry tree data if node get node type file tree type dir files push back node get name it nodes std string dir dir node get full name glue set progress caption printf restoring in s dir c str restore files if files empty make args args args add option add std vector std string iterator it files files begin while it files files end args add arg it files it files ok glue command dir args if ok goto cleanup todo do we want to reuse an existing backup in case the file has been modified if so we d have to do an update since the backups have wrong timestamps but what if the file on the server has been modified in the meantime so better leave it and let the user decide whether he wants to use his existing backup by deleting the file and renaming the backup on to the next node it dir nodes delete tree tree 0 cleanup if glue at least one success refresh explorer window tortoiseact performrestoremenu cvsaction filetree setprogressfinishedcaption _ getdirlist c_str mydirectorygroups directorygroup mydirectorygroups buildfiletree directorygroup entrytreedata filetree nodelist dirnodes dirnodes push_back getroot getroot getsubnodes dirnodes filetree type_dir filetree nodelist itdirnodes dirnodes filetree dirnode dirnode filetree directorygroup entrytreedata entrytreedata itdirnodes dirnodes dirnode filetree dirnode itdirnodes filetree nodeiterator itnodes dirnode itnodes dirnode itnodes entrytreedata directorygroup entrytreedata getuserdata entrytreedata getnodetype filetree type_dir push_back getname itnodes dirnode getfullname setprogresscaption _ c_str makeargs add_option itfiles itfiles add_arg itfiles itfiles itdirnodes atleastonesuccess refreshexplorerwindow void tortoise act perform update menu bool dialog tdebug enter tortoise act perform update menu bool resetsticky false std string getrevision std string getdate unsigned int i unsigned int j bool clean false bool simulate tortoise registry read boolean simulate update false bool createdirs tortoise registry read boolean create added directories true bool force head tortoise registry read boolean force head revision false bring up dialog with extra options either if they choose the menu option for it or ctrl is held down if dialog is control down bool query do update dialog 0 getrevision getdate clean createdirs simulate force head get fetch button dirs get fetch button tag if query cancel entire update operation return if getrevision head resetsticky true getrevision when cvs action is constructed the dialog appears cvs action glue 0 glue set progress finished caption printf finished update in s get dir list c str c str std vector std string conflict files for j 0 j my directory groups size glue aborted j directory group group my directory groups j make args args if simulate args add global option n args add option update if createdirs args add option d create missing directories that exist in the repository if tortoise registry read boolean prune empty directories true args add option p prune empty directories i e if all the files in them are removed if resetsticky args add option a if getrevision empty args add option r args add option getrevision if getdate empty args add option d args add option getdate if force head args add option f if clean args add option c for i 0 i group size i args add arg group i my relative file glue set progress caption printf updating in s group my directory c str glue command group my directory args if glue aborted break std string out glue get std out identical files need another cvs update std vector std string identical files parse identical group out identical files put them into a map if identical files empty make args args args add option update std vector std string const iterator it identical files begin std string s while it identical files end s it substr ensure trailing delimiter group my directory length args add arg s it glue command group my directory args check for conflicts if simulate parse conflicts group out conflict files edit conflict file if appropriate if conflict files size 0 glue lock progress dialog true do conflict list dialog glue get progress dialog conflict files glue lock progress dialog false clear the explorer window unless it was all directories being updated in which case no point if file selected glue at least one success refresh explorer window tortoiseact performupdatemenu tdebug_enter tortoiseact performupdatemenu tortoiseregistry readboolean tortoiseregistry readboolean forcehead tortoiseregistry readboolean iscontroldown doupdatedialog forcehead getfetchbuttondirs getfetchbuttontag cvsaction cvsaction setprogressfinishedcaption _ getdirlist c_str c_str conflictfiles mydirectorygroups directorygroup mydirectorygroups makeargs add_global_option add_option add_option tortoiseregistry readboolean add_option add_option add_option add_option add_option add_option forcehead add_option add_option add_arg myrelativefile setprogresscaption _ mydirectory c_str mydirectory getstdout identicalfiles parseidentical identicalfiles identicalfiles makeargs add_option const_iterator identicalfiles identicalfiles ensuretrailingdelimiter mydirectory add_arg mydirectory parseconflicts conflictfiles conflictfiles lockprogressdialog doconflictlistdialog getprogressdialog conflictfiles lockprogressdialog fileselected atleastonesuccess refreshexplorerwindow void tortoise act perform update dialog menu perform update menu true tortoiseact performupdatedialogmenu performupdatemenu void tortoise act perform web log menu only allow one file or directory if my directory groups my single absolute empty return find the path on the server std string ambient part cvs status cvs repository for path my directory groups my single absolute if is directory my directory groups my single absolute c str ambient part extract last part my directory groups my single absolute find url for this cvsroot web log web log cvs status cvs root for path my directory groups my single absolute ambient part scan and or query user to find out what url to use std string url bool result web log perform search and query url see if we failed to find anything e g user cancelled if result return detect plain log which just does cvs log in the progress window if url plainlog perform log menu return launch the url launchurl url tortoiseact performweblogmenu mydirectorygroups mysingleabsolute ambientpart cvsstatus cvsrepositoryforpath mydirectorygroups mysingleabsolute isdirectory mydirectorygroups mysingleabsolute c_str ambientpart extractlastpart mydirectorygroups mysingleabsolute weblog weblog cvsstatus cvsrootforpath mydirectorygroups mysingleabsolute ambientpart weblog performsearchandquery performlogmenu void tortoise act perform tag menu std string tagname tortoise registry read string failed tag name bool checkunmodified int action if do tag dialog 0 tagname checkunmodified action get fetch button dirs cvs action glue 0 glue set progress finished caption printf finished tagging in s get dir list c str for unsigned int j 0 j my directory groups size j directory group group my directory groups j make args args args add option tag if checkunmodified args add option c switch action case branch tag dlg tag action create break case branch tag dlg tag action move args add option f break case branch tag dlg tag action delete args add option d break default do message dialog glue get progress dialog internal error invalid action break args add option tagname for unsigned int i 0 i group size i args add arg group i my relative file glue set progress caption printf tagging in s group my directory c str if glue command group my directory args tortoise registry write string failed tag name tagname return else tortoise registry write string failed tag name tortoiseact performtagmenu tortoiseregistry readstring failedtagname dotagdialog getfetchbuttondirs cvsaction setprogressfinishedcaption _ getdirlist c_str mydirectorygroups directorygroup mydirectorygroups makeargs add_option add_option branchtagdlg tagactioncreate branchtagdlg tagactionmove add_option branchtagdlg tagactiondelete add_option domessagedialog getprogressdialog _ add_option add_arg myrelativefile setprogresscaption _ mydirectory c_str mydirectory tortoiseregistry writestring failedtagname tortoiseregistry writestring failedtagname void tortoise act perform branch menu std string branchname bool checkunmodified int action if do branch dialog 0 branchname checkunmodified action get fetch button dirs cvs action glue 0 glue set progress finished caption printf finished branching in s get dir list c str for unsigned int j 0 j my directory groups size j directory group group my directory groups j cvs status cvs version info serverversion cvs status get servercvs version group mycvs root glue make args args args add option tag if checkunmodified args add option c switch action case branch tag dlg tag action create args add option b break case branch tag dlg tag action move args add option b args add option f b was introduced in 1 11 p2 if serverversion cvs status cvs version info 1 11 1p2 args add option b break case branch tag dlg tag action delete args add option d b was introduced in 1 11 p2 if serverversion cvs status cvs version info 1 11 1p2 args add option b break default do message dialog glue get progress dialog internal error invalid action break args add option branchname for unsigned int i 0 i group size i args add arg group i my relative file glue set progress caption printf branching in s group my directory c str if glue command group my directory args return tortoiseact performbranchmenu dobranchdialog getfetchbuttondirs cvsaction setprogressfinishedcaption _ getdirlist c_str mydirectorygroups directorygroup mydirectorygroups cvsstatus cvsversioninfo cvsstatus getservercvsversion mycvsroot makeargs add_option add_option branchtagdlg tagactioncreate add_option branchtagdlg tagactionmove add_option add_option cvsstatus cvsversioninfo add_option branchtagdlg tagactiondelete add_option cvsstatus cvsversioninfo add_option domessagedialog getprogressdialog _ add_option add_arg myrelativefile setprogresscaption _ mydirectory c_str mydirectory void tortoise act perform merge menu std string fromtag std string rev1 rev2 unsigned int i if my parameters get value count r 0 merging between two revisions rev1 my parameters get value r 0 rev2 my parameters get value r 1 bool createdirs false does not make sense for single files if rev1 empty single revision createdirs tortoise registry read boolean create added directories true determine if we have a directory argument bool got folder false unsigned int j for j 0 got folder j my directory groups size j directory group group my directory groups j if group empty got folder true break for unsigned int i 0 i group size i if is directory group i my absolute file c str got folder true break if do merge dialog 0 rev1 rev2 get fetch button dirs got folder createdirs return std vector std string conflict files cvs action glue 0 unsigned int j for j 0 j my directory groups size j std vector std string bin files std vector std string text files if any files are read only do a cvs edit on them directory group group my directory groups j glue set progress caption printf editing before merge in s group my directory c str sort into text binary first todo does it make sense to try to merge binary files for unsigned int i 0 i group size i std string absolute file group i my absolute file bin files clear text files clear if is directory absolute file c str is read only absolute file c str if cvs status is binary absolute file bin files push back group i my relative file else text files push back group i my relative file for binary files we do a cvs update first followed by cvs edit c if bin files empty make args args update make args args edit args update add option update args edit add option edit args edit add option z args edit add option c for unsigned int i 0 i bin files size i args update add arg bin files i args edit add arg bin files i if glue command group my directory args update return if glue command group my directory args edit return for text files we just do cvs edit if text files empty build the argument lists make args args edit args edit add option edit args edit add option z for unsigned int i 0 i text files size i args edit add arg text files i if glue command group my directory args edit return now for the actual merge for j 0 j my directory groups size j glue set progress finished caption printf finished merge in s get dir list c str directory group group my directory groups j make args args args add option update args add option j args add option rev1 if rev2 empty args add option j args add option rev2 if createdirs args add option d create missing directories that exist in the repository for i 0 i group size i args add arg group i my relative file glue set progress caption printf merging in s group my directory c str if glue command group my directory args return check for conflicts std string out glue get std out parse conflicts group out conflict files edit conflict file if appropriate if conflict files size 0 glue lock progress dialog true do conflict list dialog glue get progress dialog conflict files glue lock progress dialog false if file selected glue at least one success refresh explorer window tortoiseact performmergemenu myparameters getvaluecount myparameters getvalue myparameters getvalue tortoiseregistry readboolean gotfolder gotfolder mydirectorygroups directorygroup mydirectorygroups gotfolder isdirectory myabsolutefile c_str gotfolder domergedialog getfetchbuttondirs gotfolder conflictfiles cvsaction mydirectorygroups binfiles textfiles directorygroup mydirectorygroups setprogresscaption _ mydirectory c_str absolutefile myabsolutefile binfiles textfiles isdirectory absolutefile c_str isreadonly absolutefile c_str cvsstatus isbinary absolutefile binfiles push_back myrelativefile textfiles push_back myrelativefile binfiles makeargs argsupdate makeargs argsedit argsupdate add_option argsedit add_option argsedit add_option argsedit add_option binfiles argsupdate add_arg binfiles argsedit add_arg binfiles mydirectory argsupdate mydirectory argsedit textfiles makeargs argsedit argsedit add_option argsedit add_option textfiles argsedit add_arg textfiles mydirectory argsedit mydirectorygroups setprogressfinishedcaption _ getdirlist c_str directorygroup mydirectorygroups makeargs add_option add_option add_option add_option add_option add_option add_arg myrelativefile setprogresscaption _ mydirectory c_str mydirectory getstdout parseconflicts conflictfiles conflictfiles lockprogressdialog doconflictlistdialog getprogressdialog conflictfiles lockprogressdialog fileselected atleastonesuccess refreshexplorerwindow void tortoise act perform help std string url get tortoise directory help html launchurl url tortoiseact performhelp gettortoisedirectory void tortoise act perform prefs tortoise preferences prefs do preferences dialog 0 prefs tortoiseact performprefs tortoisepreferences dopreferencesdialog void tortoise act perform edit tdebug enter tortoise act perform edit cvs action glue 0 my directory groups my do not group directories true preprocess file list glue set progress finished caption printf finished edit in s get dir list c str int number of files 0 for unsigned int j 0 j my directory groups size j directory group group my directory groups j glue set progress caption printf editing in s group my directory c str sort into text binary first std vector std string bin files std vector std string text files if group size tdebug trace dir group my directory 1 this is a directory to make sure we handle binary files correctly we have to add all unmodified files to our lists std vector std string unmodified do not edit writable files std vector std string writable cvs status recursive scan group my directory 0 0 0 unmodified writable 0 group my entries clear std string directory group my directory directory ensure trailing delimiter directory for std vector std string const iterator it unmodified begin it unmodified end it tdebug trace adding it group my entries push back new directory group entry group it it substr directory length std vector std string abs files in subdirs std vector std string rel files in subdirs for unsigned int i 0 i group size i std string absolute file group i my absolute file if is directory absolute file c str tdebug trace dir absolute file 2 this is a directory to make sure we handle binary files correctly we have to add all unmodified files to our lists std vector std string unmodified do not edit writable files std vector std string writable cvs status recursive scan absolute file 0 0 0 unmodified writable 0 group my entries clear std string directory group my directory directory ensure trailing delimiter directory for std vector std string const iterator it unmodified begin it unmodified end it tdebug trace adding it if cvs status is binary it bin files push back it substr directory length else text files push back it substr directory length else tdebug trace file absolute file file if cvs status is binary absolute file bin files push back group i my relative file else text files push back group i my relative file for binary files we do a cvs update first followed by cvs edit c if bin files empty make args args update make args args edit args update add option update args edit add option edit args edit add option z args edit add option c for unsigned int i 0 i bin files size i tdebug trace binary bin files i args update add arg bin files i args edit add arg bin files i if glue command group my directory args update goto cleanup if glue command group my directory args edit goto cleanup number of files bin files size for text files we just do cvs edit if text files empty build the argument lists make args args edit args edit add option edit args edit add option z for unsigned int i 0 i text files size i tdebug trace text text files i args edit add arg text files i if glue command group my directory args edit goto cleanup number of files text files size cleanup if glue at least one success refresh explorer window tortoiseact performedit tdebug_enter tortoiseact performedit cvsaction mydirectorygroups mydonotgroupdirectories preprocessfilelist setprogressfinishedcaption _ getdirlist c_str numberoffiles mydirectorygroups directorygroup mydirectorygroups setprogresscaption _ mydirectory c_str binfiles textfiles tdebug_trace mydirectory cvsstatus recursivescan mydirectory myentries mydirectory ensuretrailingdelimiter const_iterator tdebug_trace myentries push_back directorygroup absfilesinsubdirs relfilesinsubdirs absolutefile myabsolutefile isdirectory absolutefile c_str tdebug_trace absolutefile cvsstatus recursivescan absolutefile myentries mydirectory ensuretrailingdelimiter const_iterator tdebug_trace cvsstatus isbinary binfiles push_back textfiles push_back tdebug_trace absolutefile cvsstatus isbinary absolutefile binfiles push_back myrelativefile textfiles push_back myrelativefile binfiles makeargs argsupdate makeargs argsedit argsupdate add_option argsedit add_option argsedit add_option argsedit add_option binfiles tdebug_trace binfiles argsupdate add_arg binfiles argsedit add_arg binfiles mydirectory argsupdate mydirectory argsedit numberoffiles binfiles textfiles makeargs argsedit argsedit add_option argsedit add_option textfiles tdebug_trace textfiles argsedit add_arg textfiles mydirectory argsedit numberoffiles textfiles atleastonesuccess refreshexplorerwindow void tortoise act perform unedit cvs action glue 0 glue set progress finished caption printf finished unedit in s get dir list c str for unsigned int j 0 j my directory groups size j directory group group my directory groups j make args args args add option unedit for unsigned int i 0 i group size i args add arg group i my relative file glue set progress caption printf unediting in s group my directory c str if glue command group my directory args goto cleanup cleanup if glue at least one success refresh explorer window tortoiseact performunedit cvsaction setprogressfinishedcaption _ getdirlist c_str mydirectorygroups directorygroup mydirectorygroups makeargs add_option add_arg myrelativefile setprogresscaption _ mydirectory c_str mydirectory atleastonesuccess refreshexplorerwindow void tortoise act perform list editors cvs action glue 0 glue set progress finished caption printf finished list editors in s get dir list c str bool result true glue set close cvs action close never edited file list editedfiles for unsigned int j 0 result j my directory groups size j directory group group my directory groups j result parse edits glue group editedfiles if result now show the list of edited files in the progress dialog progress dialog dlg glue get progress dialog edited file list const iterator it editedfiles begin if it editedfiles end dlg new text std string edited files n n std string me get user name while it editedfiles end dlg new text it first dlg new text n t const std vector std string editors it second for std vector std string const iterator it2 editors begin it2 editors end it2 const std string user it2 dlg new text user stricmp user c str me c str progress dialog tt modified progress dialog tt default dlg new text dlg new text n it else dlg new text std string no edited files n tortoiseact performlisteditors cvsaction setprogressfinishedcaption _ getdirlist c_str setclose cvsaction closenever editedfilelist mydirectorygroups directorygroup mydirectorygroups parseedits progressdialog getprogressdialog editedfilelist const_iterator newtext _ getusername newtext newtext const_iterator newtext c_str c_str progressdialog ttmodified progressdialog ttdefault newtext newtext newtext _ void tortoise act perform about if defined debug if is control down is shift down message box 0 testing crash dump in tortoise act test 0 int p 0 p 0 endif std string cvsversion cvs status get clientcvs version string true get ssh version std string sshversion std string loginapp quote tortoise registry read string external login application tortoise plink v security attributes sa zero memory sa sizeof sa sa n length sizeof sa sa b inherit handle true std string file unique temporary file handle h create file file c str generic write file share read sa create always file attribute normal 0 startupinfo si process information pi memset si 0 sizeof si si cb sizeof si si dw flags startf useshowwindow startf usestdhandles si w show window sw hide si h std output h si h std error get std handle std error handle si h std input get std handle std input handle if create process null lpstr loginapp c str sa sa true 0 0 0 si pi close handle pi h thread wait for single object pi h process infinite close handle pi h process std ifstream is file c str std getline is sshversion n else sshversion std string unknown close handle h delete file file c str do about dialog 0 version string cvsversion sshversion tortoiseact performabout _debug iscontroldown isshiftdown messagebox tortoiseact cvsstatus getclientcvsversionstring tortoiseregistry readstring tortoiseplink security_attributes zeromemory nlength binherithandle uniquetemporaryfile createfile c_str generic_write file_share_read create_always file_attribute_normal process_information dwflags startf_useshowwindow startf_usestdhandles wshowwindow sw_hide hstdoutput hstderror getstdhandle std_error_handle hstdinput getstdhandle std_input_handle createprocess c_str closehandle hthread waitforsingleobject hprocess closehandle hprocess c_str _ closehandle deletefile c_str doaboutdialog versionstring void tortoise act perform add ignore bool useextension cvs action glue 0 group files by directories std map std string std vector std string my file groups unsigned int j for j 0 j my directory groups size j directory group group my directory groups j for unsigned int i 0 i group size i std string cvs ignore dir group my directory std string my file path group i my relative file std string my file get last part my file path std string my dir get directory part my file path if my file empty my file my dir my dir else cvs ignore dir ensure trailing delimiter cvs ignore dir cvs ignore dir my dir my file groups cvs ignore dir push back my file pass 1 create any nonexisting cvsignore files and do cvs edit for existing files if they are readonly std map std string std vector std string iterator it my file groups begin while it my file groups end std string cvs ignore dir it first std string ignore file it first ignore file ensure trailing delimiter ignore file ignore file cvsignore if file exists ignore file c str create cvsignore std ofstream out ignore file c str else if is read only ignore file c str we must do a cvs edit cvsignore make args args args add option edit args add option z args add arg cvsignore if glue glue new cvs action 0 glue set progress finished caption printf finished adding to cvsignore in s get dir list c str if glue command cvs ignore dir args break it pass 2 update cvsignore files it my file groups begin while it my file groups end add to cvsignore file for unsigned int i 0 i it second size i std string file it second i std string extension get extension file if useextension extension empty file extension add to ignore list it first file it cvs status invalidate cache refresh explorer window delete glue tortoiseact performaddignore cvsaction myfilegroups mydirectorygroups directorygroup mydirectorygroups cvsignoredir mydirectory myfilepath myrelativefile myfile getlastpart myfilepath mydir getdirectorypart myfilepath myfile myfile mydir mydir cvsignoredir ensuretrailingdelimiter cvsignoredir cvsignoredir mydir myfilegroups cvsignoredir push_back myfile myfilegroups myfilegroups cvsignoredir ignorefile ignorefile ensuretrailingdelimiter ignorefile ignorefile fileexists ignorefile c_str ignorefile c_str isreadonly ignorefile c_str makeargs add_option add_option add_arg cvsaction setprogressfinishedcaption _ getdirlist c_str cvsignoredir myfilegroups myfilegroups getextension addtoignorelist cvsstatus invalidatecache refreshexplorerwindow bool tortoise act preprocess file list return my directory groups preprocess file list my all files tortoiseact preprocessfilelist mydirectorygroups preprocessfilelist myallfiles bool tortoise act verb needs files return my verb cvs help my verb cvs prefs my verb cvs about my verb cvs rebuild icons my verb cvs url tortoiseact verbneedsfiles myverb cvshelp myverb cvsprefs myverb cvsabout myverb cvsrebuildicons myverb cvsurl bool tortoise act verb needs preprocessing return my verb cvs help my verb cvs prefs my verb cvs about my verb cvs rebuild icons my verb cvs add recursive tortoiseact verbneedspreprocessing myverb cvshelp myverb cvsprefs myverb cvsabout myverb cvsrebuildicons myverb cvsaddrecursive void tortoise act refresh explorer window const std vector std string dirs post message my remote handle wm command 41504 0 tortoiseact refreshexplorerwindow postmessage myremotehandle wm_command bool tortoise act file selected for unsigned int j 0 j my directory groups size j directory group group my directory groups j for unsigned int i 0 i group size i if is directory group i my absolute file c str return true return false tortoiseact fileselected mydirectorygroups directorygroup mydirectorygroups isdirectory myabsolutefile c_str edited file list editedfiles make args args args add option editors for unsigned int i 0 i group size i args add arg group i my relative file std string streamfile unique temporary file glue set stream file streamfile bool result glue command group my directory args parse the log output std ifstream ifs streamfile c str std string workfile std vector std string editors while result std string line if std getline ifs line line empty if workfile empty editedfiles push back std make pair workfile editors break skip lines starting with if line 0 continue unsigned int i 0 parse name if this line starts with tab it applies to the file listed previously if line i t i else i 0 if workfile empty editedfiles push back std make pair workfile editors std string name while i line size line i t i if isspace line i break name line substr 0 i i workfile name editors clear parse name of editor int who start i while i line size line i t i if isspace line i break editors push back line substr who start i who start delete file delete file streamfile c str return result editedfilelist makeargs add_option add_arg myrelativefile uniquetemporaryfile setstreamfile mydirectory c_str push_back make_pair push_back make_pair whostart push_back whostart whostart deletefile c_str const std string cvs output std vector std string conflict files for each line starting with c add the following filename to the list of conflicting files cvs status invalidate cache std stringstream ifs cvs output c str while true std string line if std getline ifs line line empty break ignore lines that are shorter than 2 chars if line length 2 continue if line 0 c line 1 std string file group my directory file ensure trailing delimiter file int i 2 while isprint line i i file line substr 2 i 2 find and replace std string file we only process non binary files that need a merge if cvs status get file status file cvs status status conflict do not edit conflict file if the file is binary if cvs status is binary file conflict files push back file return true cvsoutput conflictfiles cvsstatus invalidatecache cvsoutput c_str mydirectory ensuretrailingdelimiter findandreplace cvsstatus getfilestatus cvsstatus status_conflict cvsstatus isbinary conflictfiles push_back const std string cvs output std vector std string committed files for each line starting with checking in add the following filename to the list of edited files std stringstream ifs cvs output c str const unsigned int phraselength checkin strlen cvsparse checking in const unsigned int phraselength remove strlen cvsparse removing while true std string line if std getline ifs line line empty break ignore lines that are shorter than 12 chars if line length std min phraselength checkin phraselength remove continue if line substr 0 phraselength checkin cvsparse checking in std string file group my directory file ensure trailing delimiter file int i phraselength checkin 1 while line i i file line substr phraselength checkin i phraselength checkin find and replace std string file committed files push back file else if line substr 0 phraselength remove cvsparse removing std string file group my directory file ensure trailing delimiter file int i phraselength remove 1 while line i i file line substr phraselength remove i phraselength remove find and replace std string file committed files push back file return true cvsoutput committedfiles cvsoutput c_str phraselengthcheckin phraselengthremove phraselengthcheckin phraselengthremove phraselengthcheckin mydirectory ensuretrailingdelimiter phraselengthcheckin phraselengthcheckin phraselengthcheckin findandreplace committedfiles push_back phraselengthremove mydirectory ensuretrailingdelimiter phraselengthremove phraselengthremove phraselengthremove findandreplace committedfiles push_back const std string cvs output std vector std string identical files std stringstream ifs cvs output c str std string file std string size type p while true std string line if std getline ifs line line empty break p line find cvsparse already contains the differences between if p std string npos file line substr 0 p file ensure trailing delimiter group my directory file identical files push back file return true cvsoutput identicalfiles cvsoutput c_str size_type ensuretrailingdelimiter mydirectory identicalfiles push_back bool b nested conflicts std ifstream if conflict file std ofstream of working copy std ofstream of new revision std string line std string size type pos int state int i nesting level 0 bool b result false bool b first linenr true bool b first linewc true std string s revision none b nested conflicts false open input file if conflict file open s conflict file name c str std ios binary create output files of working copy open s working copy file name c str std ios base out std ios base trunc of new revision open s new revision file name c str std ios base out std ios base trunc state 0 line reader std string lr if conflict file line reader std string crlf style dos if is unix sandbox strip last part s conflict file name lr set crlf style line reader std string crlf style unix while lr read line line switch state in common section case 0 search beginning of conflict section pos line find if pos 0 working copy section starts state 1 b result true else we re in the common section so write to both files if b first linenr of new revision std endl else b first linenr false of new revision line if b first linewc of working copy std endl else b first linewc false of working copy line break in working copy section case 1 search beginning of conflict section pos line find if pos 0 nested conflict section starts state 3 if b first linewc of working copy std endl else b first linewc false of working copy line else pos line find if pos std string npos pos line length 7 line line substr 0 pos if line empty if b first linewc of working copy std endl else b first linewc false of working copy line new revision section state 2 else if b first linewc of working copy std endl else b first linewc false of working copy line break in new revision section case 2 search beginning of nested conflict section pos line find if pos 0 nested conflict section starts state 4 if b first linenr of new revision std endl else b first linenr false of new revision line else pos line find if pos std string npos s revision line substr pos 8 line line substr 0 pos if line empty if b first linenr of new revision std endl else b first linenr false of new revision line common section state 0 else if b first linenr of new revision std endl else b first linenr false of new revision line break in nested section in working copy section case 3 search beginning of nested conflict section b nested conflicts true pos line find if pos 0 i nesting level else pos line find if pos std string npos if i nesting level 0 state 1 else i nesting level if b first linewc of working copy std endl else b first linewc false of working copy line break in nested section in new revision section case 4 search beginning of nested conflict section pos line find if pos 0 i nesting level else pos line find if pos std string npos if i nesting level 0 state 2 else i nesting level if b first linenr of new revision std endl else b first linenr false of new revision line break flush of new revision flush of working copy flush close of new revision close of working copy close return b result bnestedconflicts ifconflictfile ofworkingcopy ofnewrevision size_type inestinglevel bresult bfirstlinenr bfirstlinewc srevision bnestedconflicts ifconflictfile sconflictfilename c_str ofworkingcopy sworkingcopyfilename c_str ios_base ios_base ofnewrevision snewrevisionfilename c_str ios_base ios_base linereader ifconflictfile linereader crlfstyledos isunixsandbox striplastpart sconflictfilename setcrlfstyle linereader crlfstyleunix readline bresult bfirstlinenr ofnewrevision bfirstlinenr ofnewrevision bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy bfirstlinenr ofnewrevision bfirstlinenr ofnewrevision srevision bfirstlinenr ofnewrevision bfirstlinenr ofnewrevision bfirstlinenr ofnewrevision bfirstlinenr ofnewrevision bnestedconflicts inestinglevel inestinglevel inestinglevel bfirstlinewc ofworkingcopy bfirstlinewc ofworkingcopy inestinglevel inestinglevel inestinglevel bfirstlinenr ofnewrevision bfirstlinenr ofnewrevision ofnewrevision ofworkingcopy ofnewrevision ofworkingcopy bresult c annotation list c annotation list clear cannotationlist cannotationlist c annotation list c annotation list std vector c annotation iterator it annotation list begin while it annotation list end delete it it cannotationlist cannotationlist cannotation annotationlist annotationlist c annotation operator unsigned int index if index annotation list size return 0 return annotation list index cannotation annotationlist annotationlist void c annotation list sort sort column sort by bool ascending my sort col sort by my sort asc ascending std stable sort annotation list begin annotation list end c annotation list compare annotations cannotationlist sortcolumn sortby mysortcol sortby mysortasc stable_sort annotationlist annotationlist cannotationlist compareannotations unsigned int c annotation list add annotation const std string line annotation list push back new c annotation this annotation list size 1 line tm date annotation list annotation list size 1 date time t item date mktime date if min date 0 item date min date min date item date if max date 0 item date max date max date item date date map item date 1 return annotation list size cannotationlist addannotation annotationlist push_back cannotation annotationlist annotationlist annotationlist time_t itemdate mindate itemdate mindate mindate itemdate maxdate itemdate maxdate maxdate itemdate datemap itemdate annotationlist void c annotation list clear annotation list clear min date 0 max date 0 cannotationlist annotationlist mindate maxdate c annotation item2 const c annotation list list item1 list bool b result true switch list my sort col case sort line unsigned int line num1 item1 line num unsigned int line num2 item2 line num b result line num1 line num2 break case sort rev const c rev number rev1 item1 rev num const c rev number rev2 item2 rev num b result rev1 cmp rev2 0 break case sort author const std string author1 item1 author const std string author2 item2 author b result strcmp author1 c str author2 c str 0 break case sort date time t date1 mktime item1 date time t date2 mktime item2 date b result int difftime date1 date2 0 break case sort text const std string text1 item1 text const std string text2 item2 text b result strcmp text1 c str text2 c str 0 break default assert false return b result list my sort asc cannotation cannotationlist bresult mysortcol sort_line linenum1 linenum linenum2 linenum bresult linenum1 linenum2 sort_rev crevnumber revnum crevnumber revnum bresult sort_author bresult c_str c_str sort_date time_t time_t bresult sort_text bresult c_str c_str bresult mysortasc c annotation c annotation clear cannotation cannotation const std string line my list alist if set annotation line num line clear mylist setannotation linenum c annotation c annotation cannotation cannotation bool c annotation set annotation unsigned int line num const std string line bool result parse line if result this line num line num return result cannotation setannotation linenum linenum linenum void c annotation clear line num 0 rev num reset author erase memset date 0 sizeof date text erase cannotation linenum revnum bool c annotation parse const std string line clear if line empty return false std string token std string size type begin 0 std string size type end 0 revision number end line find begin if end std string npos return false token line substr begin end std string size type token length token length std string num for end token find begin num token substr begin end begin rev num atoi num c str begin end 1 if end std string npos end token length 1 break author begin line find token length if begin std string npos return false begin end line find begin if end std string npos return false end line rfind end if end std string npos return false author line substr begin end begin trim trailing whitespace from author author erase author find last not of 1 date begin line find first not of end if begin std string npos return false end line find begin if end std string npos return false token line substr begin end begin if datestring to tm token c str date return false text begin line find first not of end if begin std string npos return false text line substr begin 1 return true cannotation size_type size_type size_type tokenlength revnum c_str tokenlength tokenlength find_last_not_of find_first_not_of datestring_to_tm c_str find_first_not_of void ext combo box set auto drop down width iterate through items int w get size get width int n get count int i x y sw wx string s rect r send message get hwnd cb getdroppedcontrolrect 0 lparam r int h send message get hwnd cb getitemheight 0 0 int nmax r bottom r top get size get height 2 h if n nmax sw get system metrics sm cxvscroll else sw 0 for i 0 i n i s get string i get text extent s x y x sw 8 x std min x convert dialog to pixels wx size max dropdown width 0 get width if x w w x send message get hwnd cb setdroppedwidth w 0 extcombobox setautodropdownwidth getsize getwidth getcount wxstring sendmessage gethwnd cb_getdroppedcontrolrect sendmessage gethwnd cb_getitemheight getsize getheight getsystemmetrics sm_cxvscroll getstring gettextextent convertdialogtopixels wxsize max_dropdown_width getwidth sendmessage gethwnd cb_setdroppedwidth void wx initial tip text ctrl clear initial tip if my initial tip showing my initial tip showing false set foreground colour wx system settings get colour wxsys colour windowtext again we call set value when we aren t really changing the value of the control my during initial tip change true set value my during initial tip change false wxinitialtiptextctrl clearinitialtip myinitialtipshowing myinitialtipshowing setforegroundcolour wxsystemsettings getcolour wxsys_colour_windowtext setvalue myduringinitialtipchange setvalue myduringinitialtipchange std string get date const for no date if my get date get value return my date combo get value c str return getdate mygetdate getvalue mydatecombo getvalue c_str void update dlg ok clicked write combo list my date combo history revision date item updatedlg okclicked writecombolist mydatecombo void update dlg fetch cached tag branch list std string initial tag std vector std string tags branches tagbranch remote lists get cached tag branch list tags branches my dirs std string s my revision entry get value c str tagbranch insert tagbranch end tags begin tags end tagbranch insert tagbranch end branches begin branches end if initial tag empty tagbranch push back initial tag remove duplicates std sort tagbranch begin tagbranch end tagbranch erase std unique tagbranch begin tagbranch end tagbranch end tagbranch insert tagbranch begin head my revision entry clear fill tag branch combo box my revision entry tagbranch my revision entry set value s c str updatedlg fetchcachedtagbranchlist initialtag remotelists getcachedtagbranchlist mydirs myrevisionentry getvalue c_str initialtag push_back initialtag myrevisionentry filltagbranchcombobox myrevisionentry myrevisionentry setvalue c_str int wx tree list item get current image const int image no image if is expanded if is selected image get image wxtreeitemicon selectedexpanded if image no image we usually fall back to the normal item but try just the expanded one and not selected first in this case image get image wxtreeitemicon expanded else not expanded if is selected image get image wxtreeitemicon selected maybe it doesn t have the specific image we want try the default one instead if image no image image get image return image wxtreelistitem getcurrentimage no_image isexpanded isselected getimage wxtreeitemicon_selectedexpanded no_image getimage wxtreeitemicon_expanded isselected getimage wxtreeitemicon_selected no_image getimage void wx tree list item delete children wx tree list main window tree size t count m children count for size t n 0 n count n wx tree list item child m children n if tree tree send delete event child child delete children tree delete child m children empty wxtreelistitem deletechildren wxtreelistmainwindow size_t m_children size_t wxtreelistitem m_children senddeleteevent deletechildren m_children const wx tree list main window the button int bottomy m y the button get line height this if y bottomy y bottomy int width m x m width if x width x width if is expanded size t count m children count for size t n 0 n count n m children n get size x y the button wxtreelistmainwindow thebutton m_y thebutton getlineheight m_x m_width isexpanded size_t m_children size_t m_children getsize thebutton void wx tree list header window draw current int x1 m currentx int y1 0 client to screen x1 y1 int x2 m currentx 1 ifdef wxmsw x2 but why endif int y2 0 m owner get client size null y2 m owner client to screen x2 y2 wx screendc dc dc set logical function wxinvert dc set pen wx pen wxblack 2 wxsolid dc set brush wxtransparent brush adjustdc dc dc draw line x1 y1 x2 y2 dc set logical function wxcopy dc set pen wx null pen dc set brush wx null brush wxtreelistheaderwindow drawcurrent m_currentx clienttoscreen m_currentx __wxmsw__ m_owner getclientsize m_owner clienttoscreen wxscreendc setlogicalfunction setpen wxpen setbrush wxtransparent_brush drawline setlogicalfunction setpen wxnullpen setbrush wxnullbrush void wx tree list header window add column const wx tree list column info col m columns add col m total col width col get width m owner get header window refresh m dirty true m owner adjust my scrollbars m owner m dirty true refresh wxtreelistheaderwindow addcolumn wxtreelistcolumninfo m_columns m_total_col_width getwidth m_owner getheaderwindow m_dirty m_owner adjustmyscrollbars m_owner m_dirty const wx tree list column info col wxcheck ret before get column count wxt invalid column index m columns insert col before m total col width col get width m dirty true m owner get header window refresh m owner adjust my scrollbars m owner m dirty true refresh wxtreelistcolumninfo wxcheck_ret getcolumncount m_columns m_total_col_width getwidth m_dirty m_owner getheaderwindow m_owner adjustmyscrollbars m_owner m_dirty void wx tree list header window remove column size t column wxcheck ret column get column count wxt invalid column m total col width m columns column get width m columns remove at column m dirty true m owner adjust my scrollbars m owner m dirty true refresh wxtreelistheaderwindow removecolumn size_t wxcheck_ret getcolumncount m_total_col_width m_columns getwidth m_columns removeat m_dirty m_owner adjustmyscrollbars m_owner m_dirty const wx tree list column info info wxcheck ret column get column count wxt invalid column size t w m columns column get width m columns column info m owner get header window refresh m dirty true if w info get width m total col width info get width w m owner adjust my scrollbars m owner m dirty true refresh wxtreelistcolumninfo wxcheck_ret getcolumncount size_t m_columns getwidth m_columns m_owner getheaderwindow m_dirty getwidth m_total_col_width getwidth m_owner adjustmyscrollbars m_owner m_dirty const wx tree list column info get column size t column const wxcheck msg column get column count wx invalid tree list column info wxt invalid column return m columns column wxtreelistcolumninfo getcolumn size_t wxcheck_msg getcolumncount wxinvalidtreelistcolumninfo m_columns wx tree list column info get column size t column wxcheck msg column get column count wx invalid tree list column info wxt invalid column return m columns column wxtreelistcolumninfo getcolumn size_t wxcheck_msg getcolumncount wxinvalidtreelistcolumninfo m_columns void wx tree list header window set column width size t column size t width if column get column count m total col width m columns column get width m columns column set width width m total col width width m owner adjust my scrollbars m owner m dirty true m dirty true refresh wxtreelistheaderwindow setcolumnwidth size_t size_t getcolumncount m_total_col_width m_columns getwidth m_columns setwidth m_total_col_width m_owner adjustmyscrollbars m_owner m_dirty m_dirty int get column width size t column const wxcheck msg column get column count 1 wxt invalid column return m columns column get width getcolumnwidth size_t wxcheck_msg getcolumncount m_columns getwidth size t wx tree list main window get count const return m anchor null 0u m anchor get children count size_t wxtreelistmainwindow getcount m_anchor m_anchor getchildrencount void wx tree list main window set indent unsigned int indent m indent indent m dirty true wxtreelistmainwindow setindent m_indent m_dirty void wx tree list main window set spacing unsigned int spacing m spacing spacing m dirty true wxtreelistmainwindow setspacing m_spacing m_dirty void wx tree list main window set line spacing unsigned int spacing m linespacing spacing m dirty true calculate line height wxtreelistmainwindow setlinespacing m_linespacing m_dirty calculatelineheight void wx tree list main window set window style const long styles right now just sets the styles eventually we may want to update the inherited styles but right now none of the parents has updatable styles m windowstyle styles m dirty true wxtreelistmainwindow setwindowstyle m_windowstyle m_dirty void wx tree list main window delete all items if m anchor m dirty true m key current null mst 16 10 03 m anchor delete children this delete m anchor m anchor null wxtreelistmainwindow deleteallitems m_anchor m_dirty m_key_current m_anchor deletechildren m_anchor m_anchor void wx tree list main window unselect if m current m current set hilight false refresh line m current wxtreelistmainwindow m_current m_current sethilight refreshline m_current void wx tree list main window unselect all unselect all children wx tree list item get root item m pitem wxtreelistmainwindow unselectall unselectallchildren wxtreelistitem getrootitem m_pitem void wx tree list main window adjust my scrollbars if m anchor int x 0 y 0 m anchor get size x y this y pixels per unit 2 one more scrollbar unit 2 pixels x pixels per unit 2 one more scrollbar unit 2 pixels int x pos get scroll pos wxhorizontal int y pos get scroll pos wxvertical x m owner get header window get width 2 if x get client size get width x pos 0 m total col width 2 alb set scrollbars pixels per unit pixels per unit x pixels per unit y pixels per unit x pos y pos else set scrollbars 0 0 0 0 wxtreelistmainwindow adjustmyscrollbars m_anchor m_anchor getsize pixels_per_unit pixels_per_unit x_pos getscrollpos y_pos getscrollpos m_owner getheaderwindow getwidth getclientsize getwidth x_pos m_total_col_width setscrollbars pixels_per_unit pixels_per_unit pixels_per_unit pixels_per_unit x_pos y_pos setscrollbars void wx tree list main window send delete event wx tree list item item wx tree event event wxevt command tree delete item m owner get id event set item long item event set event object this m owner m owner process event event wxtreelistmainwindow senddeleteevent wxtreelistitem wxtreeevent wxevt_command_tree_delete_item m_owner getid setitem seteventobject m_owner m_owner processevent void set main column size t column if column get column count m main column column setmaincolumn size_t getcolumncount m_main_column bool has buttons void const return m imagelistbuttons null hasbuttons m_imagelistbuttons void wx tree list main window calculate line height wx clientdc dc this m lineheight int dc get char height m linespacing 2 if m imagelistnormal calculate a m lineheight value from the normal image sizes may be toggle off then wx tree list main window will spread when necessary which might look ugly int n m imagelistnormal get image count for int i 0 i n i int width 0 height 0 m imagelistnormal get size i width height if height m lineheight m lineheight height if m imagelistbuttons calculate a m lineheight value from the button image sizes may be toggle off then wx tree list main window will spread when necessary which might look ugly int n m imagelistbuttons get image count for int i 0 i n i int width 0 height 0 m imagelistbuttons get size i width height if height m lineheight m lineheight height if m lineheight 30 m lineheight 2 at least 2 pixels else m lineheight m lineheight 10 otherwise 10 extra spacing wxtreelistmainwindow calculatelineheight wxclientdc m_lineheight getcharheight m_linespacing m_imagelistnormal m_lineheight wxtreelistmainwindow m_imagelistnormal getimagecount m_imagelistnormal getsize m_lineheight m_lineheight m_imagelistbuttons m_lineheight wxtreelistmainwindow m_imagelistbuttons getimagecount m_imagelistbuttons getsize m_lineheight m_lineheight m_lineheight m_lineheight m_lineheight m_lineheight int wx tree list main window get line height wx tree list item item const if get window style flag wxtr has variable row height return item get height else return m lineheight wxtreelistmainwindow getlineheight wxtreelistitem getwindowstyleflag wxtr_has_variable_row_height getheight m_lineheight void wx tree list main window calculate positions if m anchor return wx clientdc dc this preparedc dc dc set font m normalfont dc set pen m dottedpen if get image list null m lineheight int dc get char height 4 int y 2 int x offset 0 for size t i 0 i get main column i x offset m owner get header window get column width i calculate level m anchor dc 0 y x offset start recursion wxtreelistmainwindow calculatepositions m_anchor wxclientdc setfont m_normalfont setpen m_dottedpen getimagelist m_lineheight getcharheight x_offset size_t getmaincolumn x_offset m_owner getheaderwindow getcolumnwidth calculatelevel m_anchor x_offset void wx tree list main window refresh subtree wx tree list item item if m dirty return wx clientdc dc this preparedc dc int cw 0 int ch 0 get client size cw ch get virtual size cw ch wx rect rect rect x dc logical to devicex 0 rect width cw rect y dc logical to devicey item gety 2 rect height ch refresh true rect adjust my scrollbars wxtreelistmainwindow refreshsubtree wxtreelistitem m_dirty wxclientdc getclientsize getvirtualsize wxrect logicaltodevicex logicaltodevicey adjustmyscrollbars void wx tree list main window refresh line wx tree list item item if m dirty return wx clientdc dc this preparedc dc int cw 0 int ch 0 get client size cw ch get virtual size cw ch wx rect rect rect x dc logical to devicex 0 rect y dc logical to devicey item gety rect width cw rect height get line height item dc get char height 6 refresh true rect wxtreelistmainwindow refreshline wxtreelistitem m_dirty wxclientdc getclientsize getvirtualsize wxrect logicaltodevicex logicaltodevicey getlineheight getcharheight void wx tree list main window refresh selected todo this is awfully inefficient we should keep the list of all selected items internally should be much faster if m anchor refresh selected under m anchor wxtreelistmainwindow refreshselected m_anchor refreshselectedunder m_anchor void wx tree list main window refresh selected under wx tree list item item if item is selected refresh line item const wx array tree list items children item get children size t count children get count for size t n 0 n count n refresh selected under children n wxtreelistmainwindow refreshselectedunder wxtreelistitem isselected refreshline wxarraytreelistitems getchildren size_t getcount size_t refreshselectedunder void wx tree list main window on rename timer edit m current wxtreelistmainwindow onrenametimer m_current void wx tree list main window on rename accept todo if the validator fails this causes a crash wx tree event le wxevt command tree end label edit m owner get id le set item long m currentedit le set event object this m owner le set label m renameres m owner get event handler process event le if le is allowed return set item text m currentedit m renameres wxtreelistmainwindow onrenameaccept wxtreeevent wxevt_command_tree_end_label_edit m_owner getid setitem m_currentedit seteventobject m_owner setlabel m_renameres m_owner geteventhandler processevent isallowed setitemtext m_currentedit m_renameres void wx tree list main window select item range wx tree list item item1 wx tree list item item2 item2 is not necessary after item1 wx tree list item first null last null choice first and last between item1 and item2 if item1 gety item2 gety first item1 last item2 else first item2 last item1 bool select m current is selected if tag all children until last first last select return tag next children first last select wxtreelistmainwindow selectitemrange wxtreelistitem wxtreelistitem wxtreelistitem m_current isselected tagallchildrenuntillast tagnextchildren bool wx tree list main window tag all children until last wx tree list item crt item wx tree list item last item bool select crt item set hilight select refresh line crt item if crt item last item return true if crt item has children wx array tree list items children crt item get children size t count children count for size t n 0 n count n if tag all children until last children n last item select return true return false wxtreelistmainwindow tagallchildrenuntillast wxtreelistitem crt_item wxtreelistitem last_item crt_item sethilight refreshline crt_item crt_item last_item crt_item haschildren wxarraytreelistitems crt_item getchildren size_t size_t tagallchildrenuntillast last_item bool wx tree list main window tag next children wx tree list item crt item wx tree list item last item bool select wx tree list item parent crt item get parent if parent null this is root item return tag all children until last crt item last item select wx array tree list items children parent get children int index children index crt item wxassert index wxnot found i m not a child of my parent size t count children count for size t n size t index 1 n count n if tag all children until last children n last item select return true return tag next children parent last item select wxtreelistmainwindow tagnextchildren wxtreelistitem crt_item wxtreelistitem last_item wxtreelistitem crt_item getparent tagallchildrenuntillast crt_item last_item wxarraytreelistitems getchildren crt_item wxnot_found size_t size_t size_t tagallchildrenuntillast last_item tagnextchildren last_item void wx tree list main window unselect all children wx tree list item item if item is selected item set hilight false refresh line item if item has children wx array tree list items children item get children size t count children count for size t n 0 n count n unselect all children children n wxtreelistmainwindow unselectallchildren wxtreelistitem isselected sethilight refreshline haschildren wxarraytreelistitems getchildren size_t size_t unselectallchildren void wx tree list main window draw drop effect wx tree list item item if item if item has plus it s a folder indicate it by a border draw border item else draw a line under the drop target because the item will be dropped there draw line item true below set cursor wxcursor bullseye else can t drop here set cursor wxcursor no entry wxtreelistmainwindow drawdropeffect wxtreelistitem hasplus drawborder drawline setcursor wxcursor_bullseye setcursor wxcursor_no_entry wx tree list column align align m header win set column column get column column set alignment align wxtreelistcolumnalign m_header_win setcolumn getcolumn setalignment wx tree list column align wx tree list ctrl get column alignment size t column const return m header win get column column get alignment wxtreelistcolumnalign wxtreelistctrl getcolumnalignment size_t m_header_win getcolumn getalignment void wx tree list ctrl set column image size t column int image m header win set column column get column column set image image wxtreelistctrl setcolumnimage size_t m_header_win setcolumn getcolumn setimage int wx tree list ctrl get column image size t column const return m header win get column column get image wxtreelistctrl getcolumnimage size_t m_header_win getcolumn getimage void wx tree list ctrl set window style const long style if m main win m main win set window style style todo provide something like wxtl no headers to hide m header win wxtreelistctrl setwindowstyle m_main_win m_main_win setwindowstyle wxtl_no_headers m_header_win long wx tree list ctrl get window style const long style m windowstyle if m main win style m main win get window style return style wxtreelistctrl getwindowstyle m_windowstyle m_main_win m_main_win getwindowstyle wx tree list rename timer wx tree list rename timer wx tree list main window owner m owner owner wxtreelistrenametimer wxtreelistrenametimer wxtreelistmainwindow m_owner void wx tree list rename timer notify m owner on rename timer wxtreelistrenametimer m_owner onrenametimer void preferences dialog add cvs ignore wx panel page new wx panel my book wx box sizer sizer new wx box sizer wxvertical page set auto layout true page set sizer sizer my book add page page ignored files std string s per user list of cvsignore file name patterns s wx static text label new wx static text page 1 s c str sizer add label 0 wxalign left wxall 5 my cvs ignore new wx text ctrl page 1 wx default position wx default size wxte multiline sizer add my cvs ignore 1 wxgrow wxleft wxright 5 s hint to reset the list and include all files enter a single exclamation mark wx static text label2 new wx static text page 1 s c str label2 set foreground colour set foreground colour color ref to wx colour tortoise registry read integer colour tip text rgb 0x00 0x00 0xff sizer add label2 0 wxalign left wxall 5 s a list of files or file name patterns like exe that cvs ignores when running certain operations the entries must be separated by whitespace and are appended to the default built in ignored list a single exclamation mark resets the list for details refer to the original cvs documentation my cvs ignore set tool tip s c str read cvsignore from homedir std string home dir bool got home dir get home directory home dir if got home dir read cvsignore file from home directory my cvs ignore file ensure trailing delimiter home dir cvsignore if file exists my cvs ignore file c str my cvs ignore load file my cvs ignore file c str else my cvs ignore enable false preferencesdialog addcvsignore wxpanel wxpanel mybook wxboxsizer wxboxsizer setautolayout setsizer mybook addpage _ _ wxstatictext wxstatictext c_str wxalign_left mycvsignore wxtextctrl wxdefaultposition wxdefaultsize wxte_multiline mycvsignore _ wxstatictext wxstatictext c_str setforegroundcolour setforegroundcolour colorreftowxcolour tortoiseregistry readinteger wxalign_left _ mycvsignore settooltip c_str homedir gothomedir gethomedirectory homedir gothomedir mycvsignorefile ensuretrailingdelimiter homedir fileexists mycvsignorefile c_str mycvsignore loadfile mycvsignorefile c_str mycvsignore void icon set dialog preview icon set const std string icon set std string s icon path std string s icon file if icon set empty s icon path get icon set path icon set load icon for standard file shfileinfo sfi sh get file info txt file attribute normal sfi sizeof sfi shgfi icon shgfi usefileattributes wx icon ico file ico file sethicon wxhicon sfi h icon wx pen pen wx system settings get colour wxsys colour window 1 wxsolid wx brush brush wx system settings get colour wxsys colour window wxsolid int i 0 std vector wx static bitmap const iterator it my previews begin while it my previews end get dc for bitmap wx memorydc dc dc select object it get bitmap paint background dc set pen pen dc set brush brush dc draw rectangle 0 0 32 32 paint file icon dc draw icon ico file 0 0 load tortoise icon if s icon path empty s icon file ensure trailing delimiter s icon path psz icon names i ico wx icon ico s icon file c str wxbitmap type ico 32 32 paint overlay icon dc draw icon ico 0 0 it refresh i it iconsetdialog previewiconset iconset siconpath siconfile iconset siconpath geticonsetpath iconset shgetfileinfo file_attribute_normal shgfi_icon shgfi_usefileattributes wxicon icofile icofile hicon wxpen wxsystemsettings getcolour wxsys_colour_window wxbrush wxsystemsettings getcolour wxsys_colour_window wxstaticbitmap const_iterator mypreviews mypreviews wxmemorydc selectobject getbitmap setpen setbrush drawrectangle drawicon icofile siconpath siconfile ensuretrailingdelimiter siconpath psziconnames wxicon siconfile c_str wxbitmap_type_ico drawicon std string get tag const for no tag return my tag gettag mytag void set tag const std string tag my tag tag settag mytag std string get date const for no date return my date getdate mydate void module basics page set module const std string module my module module update module 0 modulebasicspage setmodule mymodule updatemodule void module basics page setcvs root const cvs root root mycvs root root modulebasicspage setcvsroot cvsroot mycvsroot void module basics page ok clicked sanitize cvsroot mycvs root setcvsroot remove trailing delimiter mycvs root getcvsroot write combo list my protocol parameters combo history checkout protocol parameters item write combo list my server combo history checkout server item write combo list my port combo history checkout port item write combo list my directory combo history checkout directory item write combo list my username combo history checkout username item write option menu my protocol menu history checkout protocol item read in old cvsroot history from list std vector std string history historym for int j 0 j mycvsroot list get item count j history push back mycvsroot list get item text j c str wx list item info info m mask wxlist mask text info m itemid j info m col 1 mycvsroot list get item info historym push back info m text c str erase entry if already there int found 1 for unsigned int i 0 i std min history size historym size i if history i c str mycvs root getcvsroot historym i c str my module found i if found 0 history erase history begin found historym erase historym begin found add ourselves to front if my module empty mycvs root getcvsroot empty history insert history begin mycvs root getcvsroot historym insert historym begin my module write out again tortoise registry write vector history checkout cvsroot item history 10 tortoise registry write vector history checkout cvsroot module item historym 10 modulebasicspage okclicked mycvsroot removetrailingdelimiter mycvsroot writecombolist myprotocolparameterscombo writecombolist myservercombo writecombolist myportcombo writecombolist mydirectorycombo writecombolist myusernamecombo writeoptionmenu myprotocolmenu mycvsrootlist getitemcount push_back mycvsrootlist getitemtext c_str wxlistitem m_mask wxlist_mask_text m_itemid m_col mycvsrootlist getitem push_back m_text c_str c_str mycvsroot c_str mymodule mymodule mycvsroot mycvsroot mymodule tortoiseregistry writevector tortoiseregistry writevector void module basics page set rev options rev options rev options my rev options rev options update rev options modulebasicspage setrevoptions revoptions revoptions myrevoptions revoptions updaterevoptions void module basics page update sensitivity my protocol parameters combo enable mycvs root allow protocol parameters my username combo enable mycvs root allow user my port combo enable mycvs root allow port my server combo enable mycvs root allow server find ok button on parent and ghost it appropriately wx window grandparent get grand parent wx dialog dialog wx dynamic cast grandparent wx dialog if dialog wx window ok dialog find window wxid ok if ok ok enable mycvs root valid my module fetch modules list widget my fetch module list enable mycvs root valid modulebasicspage updatesensitivity myprotocolparameterscombo mycvsroot allowprotocolparameters myusernamecombo mycvsroot allowuser myportcombo mycvsroot allowport myservercombo mycvsroot allowserver wxwindow getgrandparent wxdialog wxdynamiccast wxdialog wxwindow findwindow wxid_ok mycvsroot mymodule myfetchmodulelist mycvsroot void module basics page select in list box std string cvsroot mycvs root getcvsroot c str select in list box if available wx string cur sel list selected text wx string cur module list selected module if cur sel cvsroot c str my mode mb checkout module cur module my module c str clear selection long sel mycvsroot list get next item 1 wxlist next all wxlist state selected if sel 1 mycvsroot list set item state sel 0 wxlist state selected find and set list box to cvsroot module pair if already there if cvsroot for int i 0 i mycvsroot list get item count i wx list item info if my mode mb checkout module info m mask wxlist mask text info m itemid i info m col 1 mycvsroot list get item info if mycvsroot list get item text i cvsroot c str my mode mb checkout module info m text my module c str mycvsroot list set item state i wxlist state selected wxlist state selected modulebasicspage selectinlistbox mycvsroot c_str wxstring cursel listselectedtext wxstring curmodule listselectedmodule cursel c_str mymode mb_checkout_module curmodule mymodule c_str mycvsrootlist getnextitem wxlist_next_all wxlist_state_selected mycvsrootlist setitemstate wxlist_state_selected mycvsrootlist getitemcount wxlistitem mymode mb_checkout_module m_mask wxlist_mask_text m_itemid m_col mycvsrootlist getitem mycvsrootlist getitemtext c_str mymode mb_checkout_module m_text mymodule c_str mycvsrootlist setitemstate wxlist_state_selected wxlist_state_selected void module basics page fill in module list std vector std string modules if modules size 0 move cvsroot to the end std vector std string iterator it std find modules begin modules end cvsroot if it modules end modules erase it modules push back cvsroot my module combo clear for unsigned int j 0 j modules size j my module combo append modules j c str my module combo set value modules 0 c str my module modules 0 c str update rev options modulebasicspage fillinmodulelist push_back mymodulecombo mymodulecombo c_str mymodulecombo setvalue c_str mymodule c_str updaterevoptions void module basics page update rev options set cvsroot for revision page if my rev options null cvs root cvs root mycvs root cvs root remove trailing delimiter my rev options setcvs root mycvs root my rev options set module my module modulebasicspage updaterevoptions myrevoptions cvsroot cvsroot mycvsroot cvsroot removetrailingdelimiter myrevoptions setcvsroot mycvsroot myrevoptions setmodule mymodule void module basics page fetch cached module list my fetch module list enable false get module list and put it in the dialog std vector std string modules remote lists get cached module list modules mycvs root std string module my module combo get value c str my module combo clear fill in module list modules my module combo set value module c str my module my module combo get value modulebasicspage fetchcachedmodulelist myfetchmodulelist remotelists getcachedmodulelist mycvsroot mymodulecombo getvalue c_str mymodulecombo fillinmodulelist mymodulecombo setvalue c_str mymodule mymodulecombo getvalue void merge dlg fetch cached tag branch list std vector std string tags branches tagbranch remote lists get cached tag branch list tags branches my dirs tagbranch insert tagbranch end tags begin tags end tagbranch insert tagbranch end branches begin branches end remove duplicates std sort tagbranch begin tagbranch end tagbranch erase std unique tagbranch begin tagbranch end tagbranch end tagbranch insert tagbranch begin head wx string s1 my from entry1 get value wx string s2 my from entry2 get value my from entry1 clear my from entry2 clear fill tag branch combo box my from entry1 tagbranch fill tag branch combo box my from entry2 tagbranch my from entry1 set value s1 c str my from entry2 set value s2 c str mergedlg fetchcachedtagbranchlist remotelists getcachedtagbranchlist mydirs wxstring myfromentry1 getvalue wxstring myfromentry2 getvalue myfromentry1 myfromentry2 filltagbranchcombobox myfromentry1 filltagbranchcombobox myfromentry2 myfromentry1 setvalue c_str myfromentry2 setvalue c_str void log config dialog update text if my radiourl get value myurl prefix my prefix combo get value myurl suffix my suffix combo get value else myurl prefix myurl suffix if my radio vanilla get value myurl prefix plainlog myurl suffix if my radio scan again get value myurl prefix scanagain myurl suffix logconfigdialog updatetext myradiourl getvalue myurlprefix myprefixcombo getvalue myurlsuffix mysuffixcombo getvalue myurlprefix myurlsuffix myradiovanilla getvalue myurlprefix myurlsuffix myradioscanagain getvalue myurlprefix myurlsuffix void log config dialog update sensitivity bool state my radiourl get value my prefix combo enable state my suffix combo enable state logconfigdialog updatesensitivity myradiourl getvalue myprefixcombo mysuffixcombo void ext splitter window set right sash position int position const bool redraw set sash position get window size position redraw m rightsashpos position extsplitterwindow setrightsashposition setsashposition getwindowsize m_rightsashpos int ext splitter window get right sash position return get window size get sash position extsplitterwindow getrightsashposition getwindowsize getsashposition void ext splitter window update right sash position if m rightsashpos 0 m rightsashpos get window size get sash position extsplitterwindow updaterightsashposition m_rightsashpos m_rightsashpos getwindowsize getsashposition my index index myindex highlight false if my ref count initialize statics myrefcount initializestatics c win log data c win log data if my ref count cleanup statics cwinlogdata cwinlogdata myrefcount cleanupstatics void c win log data initialize statics my graph sel color new wx colour rgb def sel my graph highlight color new wx colour rgb def highlight my graph shadow color new wx colour rgb def shadow my graph header color new wx colour rgb def header my graph tag color new wx colour rgb def tag my graph branch color new wx colour rgb def branch my graph node color new wx colour rgb def node my graph dead node color new wx colour rgb def deadnode my graph user state node color new wx colour rgb def userstatenode my graph merge color new wx colour rgb def merge cwinlogdata initializestatics mygraphselcolor wxcolour rgb_def_sel mygraphhighlightcolor wxcolour rgb_def_highlight mygraphshadowcolor wxcolour rgb_def_shadow mygraphheadercolor wxcolour rgb_def_header mygraphtagcolor wxcolour rgb_def_tag mygraphbranchcolor wxcolour rgb_def_branch mygraphnodecolor wxcolour rgb_def_node mygraphdeadnodecolor wxcolour rgb_def_deadnode mygraphuserstatenodecolor wxcolour rgb_def_userstatenode mygraphmergecolor wxcolour rgb_def_merge void c win log data cleanup statics delete my graph sel color delete my graph highlight color delete my graph shadow color delete my graph header color delete my graph tag color delete my graph branch color delete my graph node color delete my graph dead node color delete my graph user state node color delete my graph merge color cwinlogdata cleanupstatics mygraphselcolor mygraphhighlightcolor mygraphshadowcolor mygraphheadercolor mygraphtagcolor mygraphbranchcolor mygraphnodecolor mygraphdeadnodecolor mygraphuserstatenodecolor mygraphmergecolor bool c win log data is disk node const std string rev no if get type k node rev return false if rev no empty return false return strcmp rev no c str c log node rev f node rev num str c str 0 cwinlogdata isdisknode revno gettype knoderev revno revno c_str clognoderev fnode revnum c_str bool c win log data is dead node if get type k node rev return false return strcmp dead c log node rev f node state c str 0 cwinlogdata isdeadnode gettype knoderev clognoderev fnode c_str bool c win log data is user state if get type k node rev return false return strcmp dead c log node rev f node state c str 0 strcmp exp c log node rev f node state c str 0 cwinlogdata isuserstate gettype knoderev clognoderev fnode c_str clognoderev fnode c_str void c win log data collect merge point pair pass1 std vector std pair c win log data c win log data merge pair collect merge point pair pass1 self merge pair std vector c log node iterator it node childs begin while it node childs end c win log data it get user data collect merge point pair pass1 merge pair it if node next c win log data node next get user data collect merge point pair pass1 merge pair cwinlogdata collectmergepointpairpass1 cwinlogdata cwinlogdata mergepair collectmergepointpairpass1self mergepair clognode cwinlogdata getuserdata collectmergepointpairpass1 mergepair cwinlogdata getuserdata collectmergepointpairpass1 mergepair void c win log data collect merge point pair pass2 std vector std pair c win log data c win log data merge pair collect merge point pair pass2 self merge pair std vector c log node iterator it node childs begin while it node childs end c win log data it get user data collect merge point pair pass2 merge pair it if node next c win log data node next get user data collect merge point pair pass2 merge pair cwinlogdata collectmergepointpairpass2 cwinlogdata cwinlogdata mergepair collectmergepointpairpass2self mergepair clognode cwinlogdata getuserdata collectmergepointpairpass2 mergepair cwinlogdata getuserdata collectmergepointpairpass2 mergepair void c win log rev data collect merge point pair pass1 self std vector std pair c win log data c win log data merge pair c rev file rev c log node rev node if rev merge point empty merge pair push back std make pair c win log data c win log data 0 this cwinlogrevdata collectmergepointpairpass1self cwinlogdata cwinlogdata mergepair crevfile clognoderev mergepoint mergepair push_back make_pair cwinlogdata cwinlogdata void c win log rev data collect merge point pair pass2 self std vector std pair c win log data c win log data merge pair c rev file rev c log node rev node for size t i 0 i merge pair size i if merge pair i first c log node rev merge pair i second node merge point rev rev num merge pair i first this cwinlogrevdata collectmergepointpairpass2self cwinlogdata cwinlogdata mergepair crevfile clognoderev size_t mergepair mergepair clognoderev mergepair mergepoint revnum mergepair void graph dialog update std string dir std string file wx busy cursor wait int x y my canvas get view start x y delete the old tree delete my tree my tree null my node selected 0 my old node 0 my revision1 erase my revision2 erase std string s title printf revision graph for s my filename c str my tree get log graph s title this my filename c str false 0 do draw my tree my canvas scroll x y my canvas refresh graphdialog wxbusycursor mycanvas getviewstart mytree mytree mynodeselected myoldnode myrevision1 myrevision2 stitle _ myfilename c_str mytree getloggraph stitle myfilename c_str dodraw mytree mycanvas mycanvas c rev file graph dialog get rev file from tag node c log node tag tagnode c log node header headernode c log node header get tree std string s tag tagnode c rcs file file headernode unsigned int i for i 0 i file symbolic list size i if s tag file symbolic list i tag c str break c rev number rnum file symbolic list i for i 0 i file all revs size i if file all revs i rev num rnum break return file all revs i crevfile graphdialog getrevfilefromtagnode clognodetag clognodeheader clognodeheader gettree stag crcsfile symboliclist stag symboliclist c_str crevnumber symboliclist allrevs allrevs revnum allrevs void graph dialog show revision info const c rev file rev bool b show as tool tip if b show as tool tip std stringstream ss ss rev rev num str char buf 100 tm to local datetimeformatted rev rev time buf sizeof buf false ss buf rev author c str std string s comment trim rev desc log c str find and replace std string s comment n find and replace std string s comment t if s comment length 50 s comment s comment substr 0 47 ss s comment my canvas set tool tip ss str c str else my text ctrl clear set tabstop paraformat pf zero memory pf sizeof pf pf cb size sizeof pf pf dw mask pfm tabstops pf c tab count 1 pf rgx tabs 0 tabstop send message get hwnd of my text ctrl em setparaformat 0 lparam pf wx text attr boldattr wx font deffont deffont set weight wxnormal wx text attr defattr defattr set font deffont wx font boldfont boldfont set weight wxbold boldattr set font boldfont wx string s my text ctrl set default style boldattr s revision s t my text ctrl append text s my text ctrl set default style defattr my text ctrl append text rev rev num str c str my text ctrl set default style boldattr s wx string n date t my text ctrl append text s my text ctrl set default style defattr char buf 100 tm to local datetimeformatted rev rev time buf sizeof buf false my text ctrl append text buf my text ctrl set default style boldattr s wx string n author t my text ctrl append text s my text ctrl set default style defattr my text ctrl append text rev author c str if rev merge point empty my text ctrl set default style boldattr my text ctrl append text wx string n mergepoint n my text ctrl set default style defattr my text ctrl append text rev merge point str c str my text ctrl set default style boldattr my text ctrl append text wx string n comment n my text ctrl set default style defattr my text ctrl append text trim rev desc log c str c str my text ctrl set insertion point 0 graphdialog showrevisioninfo crevfile bshowastooltip bshowastooltip revnum tm_to_local_datetimeformatted revtime c_str scomment desclog c_str findandreplace scomment findandreplace scomment scomment scomment scomment scomment mycanvas settooltip c_str mytextctrl zeromemory cbsize dwmask pfm_tabstops ctabcount rgxtabs sendmessage gethwndof mytextctrl em_setparaformat wxtextattr wxfont setweight wxtextattr setfont wxfont setweight setfont wxstring mytextctrl setdefaultstyle _ mytextctrl appendtext mytextctrl setdefaultstyle mytextctrl appendtext revnum c_str mytextctrl setdefaultstyle wxstring _ mytextctrl appendtext mytextctrl setdefaultstyle tm_to_local_datetimeformatted revtime mytextctrl appendtext mytextctrl setdefaultstyle wxstring _ mytextctrl appendtext mytextctrl setdefaultstyle mytextctrl appendtext c_str mergepoint mytextctrl setdefaultstyle mytextctrl appendtext wxstring _ mytextctrl setdefaultstyle mytextctrl appendtext mergepoint c_str mytextctrl setdefaultstyle mytextctrl appendtext wxstring _ mytextctrl setdefaultstyle mytextctrl appendtext desclog c_str c_str mytextctrl setinsertionpoint void graph dialog show header info const c rcs file file bool b show as tool tip if b show as tool tip std stringstream ss std string s file desc log c str s trim s if s empty ss s ss get filename cvs status file format fmt cvs status file options fo cvs status keyword options ko cvs status parse options file keyword subst c str fmt ko fo ss cvs status file format string fmt cvs status keyword options string ko cvs status file options string fo file tot revisions my canvas set tool tip ss str c str else wx text attr boldattr wx font deffont deffont set weight wxnormal wx text attr defattr defattr set font deffont wx font boldfont wx string s boldfont set weight wxbold boldattr set font boldfont my text ctrl clear set tabstop paraformat pf zero memory pf sizeof pf pf cb size sizeof pf pf dw mask pfm tabstops pf c tab count 1 pf rgx tabs 0 tabstop send message get hwnd of my text ctrl em setparaformat 0 lparam pf cvs status file format fmt cvs status file options fo cvs status keyword options ko cvs status parse options file keyword subst c str fmt ko fo my text ctrl set default style boldattr my text ctrl append text wx string description my text ctrl set default style defattr my text ctrl append text file desc log c str my text ctrl set default style boldattr s wx string n file format t my text ctrl append text s my text ctrl set default style defattr my text ctrl append text cvs status file format string fmt c str my text ctrl set default style boldattr s wx string n keyword substitution t my text ctrl append text s my text ctrl set default style defattr my text ctrl append text cvs status keyword options string ko c str my text ctrl set default style boldattr s wx string n storage options t my text ctrl append text s my text ctrl set default style defattr my text ctrl append text cvs status file options string fo c str my text ctrl set default style boldattr s wx string n total revisions t my text ctrl append text s my text ctrl set default style defattr std stringstream ss ss file tot revisions std ends my text ctrl append text ss str c str my text ctrl set insertion point 0 graphdialog showheaderinfo crcsfile bshowastooltip bshowastooltip desclog c_str getfilename cvsstatus fileformat cvsstatus fileoptions cvsstatus keywordoptions cvsstatus parseoptions keywordsubst c_str cvsstatus fileformatstring cvsstatus keywordoptionsstring cvsstatus fileoptionsstring totrevisions mycanvas settooltip c_str wxtextattr wxfont setweight wxtextattr setfont wxfont wxstring setweight setfont mytextctrl zeromemory cbsize dwmask pfm_tabstops ctabcount rgxtabs sendmessage gethwndof mytextctrl em_setparaformat cvsstatus fileformat cvsstatus fileoptions cvsstatus keywordoptions cvsstatus parseoptions keywordsubst c_str mytextctrl setdefaultstyle mytextctrl appendtext wxstring _ mytextctrl setdefaultstyle mytextctrl appendtext desclog c_str mytextctrl setdefaultstyle wxstring _ mytextctrl appendtext mytextctrl setdefaultstyle mytextctrl appendtext cvsstatus fileformatstring c_str mytextctrl setdefaultstyle wxstring _ mytextctrl appendtext mytextctrl setdefaultstyle mytextctrl appendtext cvsstatus keywordoptionsstring c_str mytextctrl setdefaultstyle wxstring _ mytextctrl appendtext mytextctrl setdefaultstyle mytextctrl appendtext cvsstatus fileoptionsstring c_str mytextctrl setdefaultstyle wxstring _ mytextctrl appendtext mytextctrl setdefaultstyle totrevisions mytextctrl appendtext c_str mytextctrl setinsertionpoint void graph dialog show node info c win log data data bool b show as tool tip switch data get type case k node rev show revision info c log node rev revnode c log node rev data node show revision info revnode b show as tool tip break case k node header show file info c log node header headernode c log node header data node show header info headernode b show as tool tip break case k node tag c log node tag tagnode c log node tag data node c rev file revfile get rev file from tag node tagnode show revision info revfile b show as tool tip my old node data break case k node branch break default break graphdialog shownodeinfo cwinlogdata bshowastooltip gettype knoderev clognoderev clognoderev showrevisioninfo bshowastooltip knodeheader clognodeheader clognodeheader showheaderinfo bshowastooltip knodetag clognodetag clognodetag crevfile getrevfilefromtagnode showrevisioninfo bshowastooltip myoldnode knodebranch void graph dialog show disk node tdebug enter graph dialog show disk node c win log data root c win log data get tree get user data tdebug trace got root root c win log data disk node root get disk node my rev no if disk node return wx rect r disk node self bounds int desty r get top r get bottom 2 int destx r get left r get right 2 int x y my canvas get view start x y x x my canvas get size get width 2 y y my canvas get size get height 2 my canvas scroll destx x desty y graphdialog showdisknode tdebug_enter graphdialog showdisknode cwinlogdata cwinlogdata gettree getuserdata tdebug_trace cwinlogdata disknode getdisknode myrevno disknode wxrect disknode selfbounds gettop getbottom getleft getright mycanvas getviewstart mycanvas getsize getwidth mycanvas getsize getheight mycanvas void graph canvas calc image size const wx point start point startpoint wx clientdc dc this c log node root my graph dlg get tree if root return set all the bounds locations c win log data data c win log data create new data root root set user data data std string filename my graph dlg get filename data compute bounds start point dc filename reoffset from 0 0 wx rect bounds data bounds wx point offset start point x bounds x start point y bounds y data offset offset bounds data bounds set the scroll size we add the margin of the start point offset on each side wx size size bounds get size wx size 2 start point x 2 start point y wx size shadow offset set scrollbars 1 1 size x size y my initialized true graphcanvas calcimagesize wxpoint startpoint wxclientdc clognode mygraphdlg gettree cwinlogdata cwinlogdata createnewdata setuserdata mygraphdlg getfilename computebounds startpoint wxrect wxpoint startpoint startpoint wxsize getsize wxsize startpoint startpoint wxsize shadow_offset setscrollbars myinitialized void branch tag dlg fetch cached tag branch list std vector std string tags std vector std string branches remote lists get cached tag branch list tags branches my dirs wx string s my tag entry get value my tag entry clear if my mode mode tag remove duplicates std sort tags begin tags end tags erase std unique tags begin tags end tags end fill tag branch combo box my tag entry tags else remove duplicates std sort branches begin branches end branches erase std unique branches begin branches end branches end fill tag branch combo box my tag entry branches my tag entry set value s branchtagdlg fetchcachedtagbranchlist remotelists getcachedtagbranchlist mydirs wxstring mytagentry getvalue mytagentry mymode modetag filltagbranchcombobox mytagentry filltagbranchcombobox mytagentry mytagentry setvalue int ext file dialog show modal hwnd h wnd 0 if m parent h wnd hwnd m parent gethwnd if h wnd wx the app get top window h wnd hwnd wx the app get top window gethwnd static wx char file name buffer wxmaxpath the file name wx char title buffer wxmaxfile 1 wxmaxext the file name without path file name buffer wxt 0 title buffer wxt 0 long msw flags ofn explorer required to use template ofn enablehook if our directory groups msw flags ofn enabletemplate if m dialogstyle wxhide readonly m dialogstyle wxsave msw flags ofn hidereadonly if m dialogstyle wxfile must exist msw flags ofn pathmustexist ofn filemustexist if m dialogstyle wxmultiple ofn explorer must always be specified with ofn allowmultiselect msw flags ofn allowmultiselect if wxchange dir flag is not given we shouldn t change the cwd which the standard dialog does by default if m dialogstyle wxchange dir msw flags ofn nochangedir openfilename of wx zero memory of the openfilename struct has been extended in newer version of comcdlg32 dll but as we don t use the extended fields anyhow set the struct size to the old value otherwise the programs compiled with new headers will not work with the old libraries if defined win32 winnt win32 winnt 0x0500 of l struct size sizeof openfilename sizeof void 2 sizeof dword else old headers of l struct size sizeof openfilename endif of hwnd owner h wnd of h instance wx get instance of lpstr title wxstringcast m message of lpstr file title title buffer of n max file title wxmaxfile 1 wxmaxext windows 3 0 and 3 1 if our directory groups of lp template name t idd xfiledialog of lpfn hook hook proc convert forward slashes to backslashes file selector doesn t like forward slashes and also squeeze multiple consecutive slashes into one as it doesn t like two backslashes in a row neither wx string dir size t i len m dir length dir reserve len for i 0 i len i wx char ch m dir i switch ch case t convert to backslash ch t fall through case t while i len 1 wx char ch next m dir i 1 if ch next t ch next t break ignore the next one unless it is at the start of a unc path if i 0 i else break fall through default normal char dir ch of lpstr initial dir dir c str of flags msw flags like alejandro sierra s wildcard modification in wx file selector you can put instead of a single wild card pairs of strings separated by the first string is a description and the second is the wild card you can put any number of pairs eg description1 ex1 ex1 description2 ex2 ex2 if you put a single wild card it works as before the modification wx string the filter if wx strlen m wildcard 0 the filter wx string wxt else the filter m wildcard wx string filter buffer if wx strchr the filter wxt only one filter default text filter buffer printf wx string files s s the filter c str the filter c str else more then one filter filter buffer the filter filter buffer wxt replace with 0 for i 0 i filter buffer len i if filter buffer get char i wxt filter buffer i wxt 0 of lpstr filter lptstr const wx char filter buffer of n filter index m filterindex 1 setting default file name wx strncpy file name buffer const wx char m filename wxmaxpath 1 file name buffer wxmaxpath 1 wxt 0 of lpstr file file name buffer holds returned filename of n max file wxmaxpath execute file dialog bool success m dialogstyle wxsave get save file name of get open file name of 0 dword err code comm dlg extended error if success err code cderr structsize the struct size has changed so try a smaller or bigger size int old struct size of l struct size of l struct size old struct size sizeof void 2 sizeof dword success m dialogstyle wxsave get save file name of 0 get open file name of 0 err code comm dlg extended error if success err code cderr structsize of l struct size old struct size sizeof void 2 sizeof dword success m dialogstyle wxsave get save file name of 0 get open file name of 0 if success m filenames empty if m dialogstyle wxmultiple file name buffer of n file offset 1 wxt 0 m dir file name buffer i of n file offset m filename file name buffer i m filenames add m filename i m filename len 1 while file name buffer i wxt 0 m filenames add file name buffer i i wx strlen file name buffer i 1 wx string dir m dir if m dir last t dir t m filenames sort m path dir m filename else const wx char extension null adding the correct extension m filterindex int of n filter index 1 if of n file extension of n file extension file name buffer of n file extension wxt 0 user has typed a filename without an extension a filename can end in a here abc this means it does not have an extension because later on a with the default extension is appended we remove the if filename ends with one we don t want files called abc ext int idx wx strlen file name buffer 1 if file name buffer idx wxt file name buffer idx wxt 0 int max filter int of n filter index 2l 1l extension filter buffer for int i 0 i max filter i get extension extension extension wx strlen extension 1 extension wx strrchr extension wxt if extension blabla wx strrchr extension wxt blabla wx strrchr extension wxt blabla extension 1 blabla extension 1 wxt blabla now concat extension to the file name m filename wx string file name buffer extension int len wx strlen file name buffer wx strncpy file name buffer len extension wxmaxpath len file name buffer wxmaxpath 1 wxt 0 m path file name buffer m filename wx file name from path file name buffer m filenames add m filename m dir wx path only file name buffer simulating the wxoverwrite prompt should we also test for file save style if m dialogstyle wxoverwrite prompt wx file exists file name buffer wx string message text message text printf file s already exists n do you want to replace it file name buffer if wx message box message text wxt save file as wxyes no wxicon exclamation wxyes success false else common dialog failed why ifdef wxdebug dword dw err comm dlg extended error if dw err 0 this msg is only for developers wx log error wxt common dialog failed with error code 0lx dw err else i extfiledialog showmodal hwnd m_parent hwnd m_parent hwnd wxtheapp gettopwindow hwnd wxtheapp gettopwindow wxchar filenamebuffer wxchar titlebuffer filenamebuffer titlebuffer msw_flags ofn_explorer ofn_enablehook ourdirectorygroups msw_flags ofn_enabletemplate m_dialogstyle wxhide_readonly m_dialogstyle msw_flags ofn_hidereadonly m_dialogstyle wxfile_must_exist msw_flags ofn_pathmustexist ofn_filemustexist m_dialogstyle ofn_explorer ofn_allowmultiselect msw_flags ofn_allowmultiselect wxchange_dir m_dialogstyle wxchange_dir msw_flags ofn_nochangedir wxzeromemory _win32_winnt _win32_winnt lstructsize lstructsize hwndowner hwnd hinstance wxgetinstance lpstrtitle m_message lpstrfiletitle titlebuffer nmaxfiletitle ourdirectorygroups lptemplatename _t idd_xfiledialog lpfnhook hookproc wxstring size_t m_dir wxchar m_dir _t _t _t wxchar chnext m_dir chnext _t chnext _t lpstrinitialdir c_str msw_flags wxfileselector wild_card wxstring thefilter wxstrlen m_wildcard thefilter wxstring thefilter m_wildcard wxstring filterbuffer wxstrchr thefilter filterbuffer wxstring _ thefilter c_str thefilter c_str filterbuffer thefilter filterbuffer filterbuffer filterbuffer getchar filterbuffer lpstrfilter wxchar filterbuffer nfilterindex m_filterindex defaultfilename wxstrncpy filenamebuffer wxchar m_filename filenamebuffer lpstrfile filenamebuffer nmaxfile filedialog m_dialogstyle getsavefilename getopenfilename errcode commdlgextendederror errcode cderr_structsize oldstructsize lstructsize lstructsize oldstructsize m_dialogstyle getsavefilename getopenfilename errcode commdlgextendederror errcode cderr_structsize lstructsize oldstructsize m_dialogstyle getsavefilename getopenfilename m_filenames m_dialogstyle filenamebuffer nfileoffset m_dir filenamebuffer nfileoffset m_filename filenamebuffer m_filenames m_filename m_filename filenamebuffer m_filenames filenamebuffer wxstrlen filenamebuffer wxstring m_dir m_dir _t _t m_filenames m_path m_filename wxchar m_filterindex nfilterindex nfileextension nfileextension filenamebuffer nfileextension wxstrlen filenamebuffer filenamebuffer filenamebuffer maxfilter nfilterindex filterbuffer maxfilter wxstrlen wxstrrchr wxstrrchr wxstrrchr filename m_filename wxstring filenamebuffer wxstrlen filenamebuffer wxstrncpy filenamebuffer filenamebuffer m_path filenamebuffer m_filename wxfilenamefrompath filenamebuffer m_filenames m_filename m_dir wxpathonly filenamebuffer wxoverwrite_prompt m_dialogstyle wxoverwrite_prompt wxfileexists filenamebuffer wxstring messagetext messagetext _ ndo filenamebuffer wxmessagebox messagetext wxyes_no wxicon_exclamation __wxdebug__ dwerr commdlgextendederror dwerr wxlogerror dwerr void add files dialog build file trees bool include binary tdebug enter add files dialog build file trees unsigned int i for i 0 i my directory groups size i directory group group my directory groups i get server features if group mycvs server features initialize tortoise fatal error could not connect to server create new tree file tree file tree build file tree group this add files entry tree data 0 my file trees push back file tree calculate which nodes are enabled and which aren t calc file tree enabled nodes file tree get root true false include binary addfilesdialog buildfiletrees includebinary tdebug_enter addfilesdialog buildfiletrees mydirectorygroups directorygroup mydirectorygroups mycvsserverfeatures tortoisefatalerror _ filetree filetree buildfiletree addfilesentrytreedata myfiletrees push_back filetree calcfiletreeenablednodes filetree getroot includebinary void add files dialog build gui tree set image list my tree ctrl set image list my image list add the root node wx tree item id root node id my tree ctrl add root root iterate through all directory groups unsigned int i for i 0 i my directory groups size i directory group group my directory groups i add tree items add tree nodes root node id my file trees i get root group true group my directory calc enabled nodes calc gui tree enabled nodes root node id expand nodes expand tree nodes root node id 2 set focus on first node wx tree item id value cookie wx tree item id id my tree ctrl get first child root node id cookie if id is ok my tree ctrl select item id addfilesdialog buildguitree mytreectrl setimagelist myimagelist wxtreeitemid rootnodeid mytreectrl addroot mydirectorygroups directorygroup mydirectorygroups addtreenodes rootnodeid myfiletrees getroot mydirectory calcguitreeenablednodes rootnodeid expandtreenodes rootnodeid wxtreeitemidvalue wxtreeitemid mytreectrl getfirstchild rootnodeid isok mytreectrl selectitem void add files dialog rebuild list view tdebug enter add files dialog rebuild list view wx busy cursor wait get active tree node wx tree item id id my tree ctrl get selection add files gui tree data gui tree data add files gui tree data my tree ctrl get item data id assert gui tree data 0 file tree dir node node file tree dir node gui tree data m node assert node get node type file tree type dir if node hasn t changed do nothing if node my current node my current include subdirs my include subdirs get value return remove old items my list ctrl delete all items adjust columns get column widths if gui tree data m directorygroup mycvs server features supports file options my show options my list ctrl insert column col id options options wxlist format left 0 my show options true else if gui tree data m directorygroup mycvs server features supports file options my show options my column widths col id options my list ctrl get column width col id options my show options false set column widths add new items my current node node my current include subdirs my include subdirs get value get item list my current nodes clear my current nodes reserve my current node get last child id my current node get id 1 add list items my current node my current include subdirs my list ctrl set item count my current nodes size sort list items addfilesdialog rebuildlistview tdebug_enter addfilesdialog rebuildlistview wxbusycursor wxtreeitemid mytreectrl getselection addfilesguitreedata guitreedata addfilesguitreedata mytreectrl getitemdata guitreedata filetree dirnode filetree dirnode guitreedata m_node getnodetype filetree type_dir mycurrentnode mycurrentincludesubdirs myincludesubdirs getvalue mylistctrl deleteallitems getcolumnwidths guitreedata m_directorygroup mycvsserverfeatures supportsfileoptions myshowoptions mylistctrl insertcolumn col_id_options _ wxlist_format_left myshowoptions guitreedata m_directorygroup mycvsserverfeatures supportsfileoptions myshowoptions mycolumnwidths col_id_options mylistctrl getcolumnwidth col_id_options myshowoptions setcolumnwidths mycurrentnode mycurrentincludesubdirs myincludesubdirs getvalue mycurrentnodes mycurrentnodes mycurrentnode getlastchildid mycurrentnode getid addlistitems mycurrentnode mycurrentincludesubdirs mylistctrl setitemcount mycurrentnodes sortlistitems void add files dialog update list items my list ctrl refresh false addfilesdialog updatelistitems mylistctrl bool recurse tdebug enter add files dialog add list items std string name file tree node iterator it node begin while it node end add this node add files tree data tree data add files tree data it second get user data if tree data tree data m type add files tree data type entry my current nodes push back it second if recurse if it second get node type file tree type dir add list items file tree dir node it second prefix it second get name true it tdebug_enter addfilesdialog addlistitems filetree nodeiterator addfilestreedata treedata addfilestreedata getuserdata treedata treedata m_type addfilestreedata type_entry mycurrentnodes push_back getnodetype filetree type_dir addlistitems filetree dirnode getname void add files dialog read column widths my column widths clear tortoise registry read vector dialogs add files column width column my column widths my column widths resize max column count unsigned int i 0 for i 0 i my column widths size i int w my column widths i if w 0 w max column size w def column size w wxdlg unit x this w my column widths i w addfilesdialog readcolumnwidths mycolumnwidths tortoiseregistry readvector addfiles mycolumnwidths mycolumnwidths max_column_count mycolumnwidths mycolumnwidths max_column_size def_column_size wxdlg_unit_x mycolumnwidths void add files dialog write column widths for unsigned int i 0 i my column widths size i int w my column widths i w this convert pixels to dialog wx size w 0 get width my column widths i w tortoise registry write vector dialogs add files column width column my column widths addfilesdialog writecolumnwidths mycolumnwidths mycolumnwidths convertpixelstodialog wxsize getwidth mycolumnwidths tortoiseregistry writevector addfiles mycolumnwidths void add files dialog get column widths my column widths col id name my list ctrl get column width col id name my column widths col id type my list ctrl get column width col id type my column widths col id add my list ctrl get column width col id add my column widths col id format my list ctrl get column width col id format my column widths col id keywords my list ctrl get column width col id keywords if my show options my column widths col id options my list ctrl get column width col id options addfilesdialog getcolumnwidths mycolumnwidths col_id_name mylistctrl getcolumnwidth col_id_name mycolumnwidths col_id_type mylistctrl getcolumnwidth col_id_type mycolumnwidths col_id_add mylistctrl getcolumnwidth col_id_add mycolumnwidths col_id_format mylistctrl getcolumnwidth col_id_format mycolumnwidths col_id_keywords mylistctrl getcolumnwidth col_id_keywords myshowoptions mycolumnwidths col_id_options mylistctrl getcolumnwidth col_id_options void add files dialog set column widths my list ctrl set column width col id name my column widths col id name my list ctrl set column width col id type my column widths col id type my list ctrl set column width col id add my column widths col id add my list ctrl set column width col id format my column widths col id format my list ctrl set column width col id keywords my column widths col id keywords if my show options my list ctrl set column width col id options my column widths col id options addfilesdialog setcolumnwidths mylistctrl setcolumnwidth col_id_name mycolumnwidths col_id_name mylistctrl setcolumnwidth col_id_type mycolumnwidths col_id_type mylistctrl setcolumnwidth col_id_add mycolumnwidths col_id_add mylistctrl setcolumnwidth col_id_format mycolumnwidths col_id_format mylistctrl setcolumnwidth col_id_keywords mycolumnwidths col_id_keywords myshowoptions mylistctrl setcolumnwidth col_id_options mycolumnwidths col_id_options std vector std string files long item 1 file tree node node 0 do item my list ctrl get next item item wxlist next all wxlist state selected if item 1 get associated tree node node my current nodes item files push back node get path from parent node while item 1 filetree mylistctrl getnextitem wxlist_next_all wxlist_state_selected mycurrentnodes push_back getpathfrom parentnode bool my key handler on arrow up down bool up if up get previous log message if index index else index my combo get count 1 else get next log message if index my combo get count 1 index else index 0 my text ctrl set value my comments index c str return false mykeyhandler onarrowupdown mycombo getcount mycombo getcount mytextctrl setvalue mycomments c_str bool my key handler on space if my wrap check box get value calculate current line number int pos my text ctrl get insertion point int currentline 0 while pos my text ctrl get line length currentline pos my text ctrl get line length currentline 1 currentline check if a line break should be inserted int linelength my text ctrl get line length currentline if linelength 80 my text ctrl write text n return false mykeyhandler onspace mywrapcheckbox getvalue mytextctrl getinsertionpoint mytextctrl getlinelength mytextctrl getlinelength mytextctrl getlinelength mytextctrl writetext void commit dialog copy files to clip bool names std string text std string dir int n items my files get item count for int i 0 i n items i if my files is selected i std string file my files get item text i get data std string newstr if names wx file name filename file c str newstr filename get full name put out directory headers every time directory changes if filename get path dir c str dir filename get path if text empty text r n text dir else newstr file if text empty text r n text newstr if wx the clipboard open these data objects are held by the clipboard so do not delete them in the app wx the clipboard set data new wx text data object text c str wx the clipboard close commitdialog copyfilestoclip nitems myfiles getitemcount nitems myfiles isselected myfiles getitemtext getdata wxfilename c_str getfullname getpath c_str getpath wxtheclipboard wxtheclipboard setdata wxtextdataobject c_str wxtheclipboard const std vector item data item data std vector std string const iterator it filenames begin int i 0 while it filenames end my files insert item i it c str my files set checked i true my files set item data i long item data i item data i m format cvs status get file format item data i m filename item data i m status cvs status get file status item data i m filename my files set item i 1 cvs status file format string item data i m format c str my files set item i 2 cvs status file status string item data i m status c str it i itemdata itemdata const_iterator myfiles insertitem c_str myfiles setchecked myfiles setitemdata itemdata itemdata m_format cvsstatus getfileformat itemdata m_filename itemdata m_status cvsstatus getfilestatus itemdata m_filename myfiles setitem cvsstatus fileformatstring itemdata m_format c_str myfiles setitem cvsstatus filestatusstring itemdata m_status c_str bool get export flag const return my export flag getexportflag myexportflag std string const get alternate directory const return my alternate directory getalternatedirectory myalternatedirectory bool get unix line endings flag const return my unix lines flag getunixlineendingsflag myunixlinesflag void checkout options page update wx command event event refresh event checkoutoptionspage wxcommandevent void checkout options page ok clicked wx command event event refresh event checkoutoptionspage okclicked wxcommandevent void annotate dialog apply sort c annotation list sort column col c annotation list sort line switch my sort col case 0 col c annotation list sort line break case 1 col c annotation list sort rev break case 2 col c annotation list sort author break case 3 col c annotation list sort date break case 4 col c annotation list sort text break default assert false my annotations sort col my sort ascending my list ctrl refresh my annotate canvas refresh annotatedialog applysort cannotationlist sortcolumn cannotationlist sort_line mysortcol cannotationlist sort_line cannotationlist sort_rev cannotationlist sort_author cannotationlist sort_date cannotationlist sort_text myannotations mysortascending mylistctrl myannotatecanvas void annotate dialog populate c annotation list annotation list my annotations annotation list unsigned int annotate count annotation list annotation count my list ctrl set item count annotate count create the line color array if my line colors delete my line colors my line colors 0 my line colors new wx colour annotate count unsigned int i c annotation item for i 0 i annotate count i item annotation list i item set data my line colors i apply sort return annotatedialog cannotationlist annotationlist myannotations annotationlist annotatecount annotationlist annotationcount mylistctrl setitemcount annotatecount mylinecolors mylinecolors mylinecolors mylinecolors wxcolour annotatecount cannotation annotatecount annotationlist setdata mylinecolors applysort void annotate dialog add annotation c annotation item unsigned int annotation index find sorted position for item unsigned int num items my list ctrl get item count unsigned int index num items char line num 32 itoa item line num line num 10 char date 100 tm to local dateformatted item date date sizeof date false my list ctrl insert item index std string line num c str my list ctrl set item index annotate col revision item rev num str c str 0 my list ctrl set item index annotate col author item author c str 0 my list ctrl set item index annotate col date date 0 my list ctrl set item index annotate col text item text c str 0 my list ctrl set item data index annotation index annotatedialog addannotation cannotation annotationindex numitems mylistctrl getitemcount numitems linenum linenum linenum tm_to_local_dateformatted mylistctrl insertitem linenum c_str mylistctrl setitem annotate_col_revision revnum c_str mylistctrl setitem annotate_col_author c_str mylistctrl setitem annotate_col_date mylistctrl setitem annotate_col_text c_str mylistctrl setitemdata annotationindex void annotate dialog sort items my list ctrl sort items compare func reinterpret cast long this annotatedialog sortitems mylistctrl sortitems comparefunc reinterpret_cast void annotate dialog get registry data my column widths clear tortoise registry read vector dialogs annotate column width column my column widths int sort col tortoise registry read integer dialogs annotate sort col annotate col line if sort col 0 sort col num annotate col sort col annotate col line discard corrupt registry entry my sort col annotate col sort col my sort ascending tortoise registry read boolean dialogs annotate sort ascending true my highlight type highlight type tortoise registry read integer dialogs annotate highlight 0 annotatedialog getregistrydata mycolumnwidths tortoiseregistry readvector mycolumnwidths sortcol tortoiseregistry readinteger sortcol annotate_col_line sortcol sortcol num_annotate_col sortcol annotate_col_line mysortcol annotate_col sortcol mysortascending tortoiseregistry readboolean sortascending myhighlighttype highlight_type tortoiseregistry readinteger void annotate dialog save registry data my column widths clear for int i 0 i num annotate col i int w my list ctrl get column width i w this convert pixels to dialog wx size w 0 get width my column widths push back w tortoise registry write vector dialogs annotate column width column my column widths tortoise registry write integer dialogs annotate sort col my sort col tortoise registry write boolean dialogs annotate sort ascending my sort ascending tortoise registry write integer dialogs annotate highlight my highlight type annotatedialog saveregistrydata mycolumnwidths num_annotate_col mylistctrl getcolumnwidth convertpixelstodialog wxsize getwidth mycolumnwidths push_back tortoiseregistry writevector mycolumnwidths tortoiseregistry writeinteger sortcol mysortcol tortoiseregistry writeboolean sortascending mysortascending tortoiseregistry writeinteger myhighlighttype int annotate dialog compare c annotation annotation1 c annotation annotation2 const int dir my sort ascending 1 1 switch my sort col case annotate col line unsigned int line num1 annotation1 line num unsigned int line num2 annotation2 line num if line num1 line num2 return 1 dir else if line num1 line num2 return 1 dir else return 0 case annotate col revision const c rev number rev1 annotation1 rev num const c rev number rev2 annotation2 rev num return rev1 cmp rev2 dir case annotate col author const std string author1 annotation1 author const std string author2 annotation2 author if author1 author2 return 1 dir else if author1 author2 return 1 dir else return 0 case annotate col date time t date1 mktime annotation1 date time t date2 mktime annotation2 date return int difftime date1 date2 dir case annotate col text const std string text1 annotation1 text const std string text2 annotation2 text if text1 text2 return 1 dir else if text1 text2 return 1 dir else return 0 return 0 annotatedialog cannotation cannotation mysortascending mysortcol annotate_col_line linenum1 linenum linenum2 linenum linenum1 linenum2 linenum1 linenum2 annotate_col_revision crevnumber revnum crevnumber revnum annotate_col_author annotate_col_date time_t time_t annotate_col_text int add files list ctrl on get item image long item const file tree node node my dialog my current nodes item add files entry tree data tree data add files entry tree data node get user data assert tree data tree data m type add files tree data type entry if tree data m isdirectory return my dialog my folder image index else return my dialog my file image index addfileslistctrl ongetitemimage filetree mydialog mycurrentnodes addfilesentrytreedata treedata addfilesentrytreedata getuserdata treedata treedata m_type addfilestreedata type_entry treedata m_isdirectory mydialog myfolderimageindex mydialog myfileimageindex int add files list ctrl on get item state long item const int result 0 file tree node node my dialog my current nodes item add files entry tree data tree data add files entry tree data node get user data assert tree data tree data m type add files tree data type entry set checkbox if tree data m isselected result indextostateimagemask 2 else result indextostateimagemask 1 set overlay mask if tree data m isenabled tree data m isselected result indextooverlaymask my dialog my added image index else result indextooverlaymask my dialog my not incvs image index return result addfileslistctrl ongetitemstate filetree mydialog mycurrentnodes addfilesentrytreedata treedata addfilesentrytreedata getuserdata treedata treedata m_type addfilestreedata type_entry treedata m_isselected treedata m_isenabled treedata m_isselected mydialog myaddedimageindex mydialog mynotincvsimageindex inline c log str const char newstr str 0l this newstr clogstr inline c log str const c log str newstr str 0l this newstr clogstr clogstr const char c log str operator const char newstr flush if newstr 0l return 0l int l strlen newstr str char malloc l 1 sizeof char if str 0l throw std bad alloc strcpy str newstr return this clogstr bad_alloc const c log str c log str operator const c log str newstr flush this const char newstr return this clogstr clogstr clogstr const c log str c log str set const char buf unsigned int len flush if len 0 return this str char malloc len 1 sizeof char if str 0l throw std bad alloc memcpy str buf len sizeof char str len 0 return this clogstr clogstr bad_alloc c log str c log str operator const char add to str if add to str 0l return this if str 0l this add to str return this unsigned int len strlen add to str if len 0 return this unsigned curlen length str char realloc str len curlen 1 sizeof char if str 0l throw std bad alloc memcpy str curlen add to str len sizeof char str len curlen 0 return this clogstr clogstr addtostr addtostr addtostr addtostr bad_alloc addtostr c log str c log str operator char add to str char astr 2 0 0 astr 0 add to str return this astr clogstr clogstr addtostr addtostr c log str c log str operator int add to str char astr 50 sprintf astr d add to str return this astr clogstr clogstr addtostr addtostr const c log str c log str replace char which char bywhich if str 0l return this char buf str while buf if buf which buf bywhich else buf return this clogstr clogstr void c log str flush void if str 0l return free str str 0l clogstr c rev number c rev number const char p reset while p all digits push back p crevnumber crevnumber alldigits push_back void c rev number reset void all digits erase all digits begin all digits end tag name crevnumber alldigits alldigits alldigits tagname int c rev number cmp const c rev number arev const const std vector int rev1 int list const std vector int rev2 arev int list std vector int const iterator i rev1 begin std vector int const iterator j rev2 begin while i rev1 end j rev2 end if i j return i j 1 1 i j if i rev1 end j rev2 end return 1 if i rev1 end j rev2 end return 1 return 0 crevnumber crevnumber intlist intlist const_iterator const_iterator c rev number c rev number operator int adigit all digits push back adigit return this crevnumber crevnumber alldigits push_back c rev number c rev number operator const c rev number arev reset for int i 0 i arev size i this arev i tag name arev tag return this crevnumber crevnumber crevnumber tagname bool c rev number operator const c rev number arev const if size arev size size 0 return false const std vector int rev1 int list const std vector int rev2 arev int list std vector int const iterator i rev1 begin std vector int const iterator j rev2 begin return memcmp i j size sizeof int 0 crevnumber crevnumber intlist intlist const_iterator const_iterator int c rev number operator int index const if index 0 index size return 1 return all digits index crevnumber alldigits bool c rev number ischildof const c rev number arev const if arev size 2 size return false if size 0 arev size 0 return false const std vector int rev1 int list const std vector int rev2 arev int list std vector int const iterator i rev1 begin std vector int const iterator j rev2 begin return memcmp i j arev size sizeof int 0 crevnumber crevnumber intlist intlist const_iterator const_iterator bool c rev number issamebranch const c rev number arev const if size arev size size 0 return false const std vector int rev1 int list const std vector int rev2 arev int list std vector int const iterator i rev1 begin std vector int const iterator j rev2 begin return memcmp i j size 1 sizeof int 0 crevnumber crevnumber intlist intlist const_iterator const_iterator bool c rev number ispartof const c rev number arev const const std vector int rev1 int list const std vector int rev2 arev int list std vector int const iterator i rev1 begin std vector int const iterator j rev2 begin if size 0 arev size 0 return false if arev size 1 0 special case for 1 1 1 if arev size 1 size return false return memcmp i j arev size sizeof int 0 case for 1 1 1 1 2 4 is part of 1 1 1 1 0 2 if arev size size size 2 return false if memcmp i j size 2 sizeof int 0 return false return arev int list size 2 0 int list size 2 arev int list size 1 crevnumber crevnumber intlist intlist const_iterator const_iterator intlist intlist intlist bool c rev number issubbranchof const c rev number arev const const std vector int rev1 int list const std vector int rev2 arev int list std vector int const iterator i rev1 begin std vector int const iterator j rev2 begin if size 0 arev size 0 return false if size 1 0 special case for 1 1 1 if arev size 1 size return false return memcmp i j arev size sizeof int 0 case for 1 4 0 2 is subbranch of 1 4 if arev size 2 size int list arev size 0 return false return memcmp i j arev size sizeof int 0 crevnumber crevnumber intlist intlist const_iterator const_iterator intlist std string c rev number str const std stringstream ss if all digits empty return ss str std vector int const iterator i all digits begin ss i i for i all digits end i ss ss i return ss str crevnumber alldigits const_iterator alldigits alldigits void c rev number set digits const char s const char p s char la char b char buf 10 int l strlen s erase digits all digits clear if l 0 return b buf iterate through the string while p if b buf 10 break la p 1 b p b b 0 if la la 0 b 0 all digits push back atoi buf b buf if la p p crevnumber setdigits alldigits alldigits push_back c rev file c rev file chg pos 0 chg neg 0 memset rev time 0 sizeof rev time crevfile crevfile chgpos chgneg revtime revtime c rev file c rev file const c rev file afile this afile crevfile crevfile crevfile c rev file c rev file crevfile crevfile c rev file c rev file operator const c rev file afile rev num afile rev num rev time afile rev time locker afile locker branches list afile branches list author afile author state afile state chg pos afile chg pos chg neg afile chg neg desc log afile desc log keyword subst afile keyword subst commitid afile commitid merge point afile merge point return this crevfile crevfile crevfile revnum revnum revtime revtime brancheslist brancheslist chgpos chgpos chgneg chgneg desclog desclog keywordsubst keywordsubst mergepoint mergepoint void c rev file set rev time const char s char buf 30 const char p s char b buf int state 0 while p state 6 b p b p if isdigit p b 0 switch state case 0 rev time tm year atoi buf 1900 break case 1 rev time tm mon atoi buf 1 break case 2 rev time tm mday atoi buf break case 3 rev time tm hour atoi buf break case 4 rev time tm min atoi buf break case 5 rev time tm sec atoi buf break default break b buf state while p isdigit p p crevfile setrevtime revtime tm_year revtime tm_mon revtime tm_mday revtime tm_hour revtime tm_min revtime tm_sec void c rev file set lines const char s int state const char p char b char buf 30 skip to p s state 0 while p state 2 b buf while p p p isdigit p p b p p b while p isdigit p b p p b b 0 switch state case 0 chg pos atoi buf break case 1 chg neg atoi buf break state crevfile setlines chgpos chgneg c rcs file c rcs file sel revisions 0 tot revisions 0 lock strict false crcsfile crcsfile selrevisions totrevisions lockstrict c rcs file c rcs file const c rcs file afile this afile crcsfile crcsfile crcsfile c rcs file c rcs file crcsfile crcsfile c rcs file c rcs file operator const c rcs file afile rcs file afile rcs file working file afile working file head rev afile head rev branch rev afile branch rev keyword subst afile keyword subst access list afile access list symbolic list afile symbolic list locks list afile locks list sel revisions afile sel revisions tot revisions afile tot revisions lock strict afile lock strict all revs afile all revs desc log afile desc log return this crcsfile crcsfile crcsfile rcsfile rcsfile workingfile workingfile headrev headrev branchrev branchrev keywordsubst keywordsubst accesslist accesslist symboliclist symboliclist lockslist lockslist selrevisions selrevisions totrevisions totrevisions lockstrict lockstrict allrevs allrevs desclog desclog c log node c log node c log node r root r next 0l user 0l clognode clognode clognode c log node c log node if next 0l delete next std vector c log node iterator i for i childs begin i childs end i delete i i 0l if user 0l delete user clognode clognode clognode c dummy init initialize critical section m destroylock initialize critical section m stacklock cdummyinit initializecriticalsection m_destroylock initializecriticalsection m_stacklock c dummy init delete critical section m destroylock delete critical section m stacklock cdummyinit deletecriticalsection m_destroylock deletecriticalsection m_stacklock inline static critical section get destroy lock return m destroylock critical_section getdestroylock m_destroylock inline static critical section get stack lock return m stacklock critical_section getstacklock m_stacklock my index 0 if max command line len max command line len 30000 if cmdname my options push back cmdname else if there is a cvs 95 exe in the tortoisecvs folder use that std string exe windows platform isnt cvs exe cvs95 exe std string fullpath get tortoise directory exe if file exists fullpath c str my options push back fullpath else my options push back exe int quietness tortoise registry read integer quietness 1 if quietness 1 my options push back q else if quietness 2 my options push back q otherwise noisy int compression tortoise registry read integer compression level 2 if compression 1 my options push back z3 else if compression 2 my options push back z6 else if compression 3 my options push back z9 otherwise no compression my main arg my options size myindex max_command_line_len max_command_line_len myoptions push_back windowsplatformisnt gettortoisedirectory fileexists c_str myoptions push_back myoptions push_back tortoiseregistry readinteger myoptions push_back myoptions push_back tortoiseregistry readinteger myoptions push_back myoptions push_back myoptions push_back mymainarg myoptions void make args add global option const std string arg my options insert my options begin my main arg arg my main arg makeargs add_global_option myoptions myoptions mymainarg mymainarg void make args add option const std string arg my options push back arg makeargs add_option myoptions push_back void make args add arg const std string arg std string my arg arg find and replace std string my arg my args push back my arg makeargs add_arg myarg findandreplace myarg myargs push_back myarg std string make args main command const return my options my main arg makeargs main_command myoptions mymainarg int make args get max command line len return max command line len makeargs get_max_command_line_len max_command_line_len const std string make args arg unsigned int i const if i my options size return my options i i my options size return my args i makeargs myoptions myoptions myoptions myargs int make args argc const return my options size my args size makeargs myoptions myargs void make args get next arguments unsigned int argc char argv std string arguments argc 0 argv 0 arguments if my args size check if we have exhausted the arguments if my args size my index return else we have no arguments check if this is the first call if my index return allocate memory for strings std vector std pair std string std string v temp first add options unsigned int arglen 0 unsigned int i for i 0 i my options size i std string cvsgui arg std string visual arg first option is cvs exe path if i 0 cvsgui arg my options i visual arg visual prepare my options i else cvsgui arg my options i visual arg visual prepare cvsgui arg arglen cvsgui len cvsgui arg if i 0 arglen v temp push back std pair std string std string cvsgui arg visual arg now add as many arguments as we have room for unsigned int n my args size my index if n for i 0 i n i std string cvsgui arg escape argument my args my index i std string visual arg visual prepare cvsgui arg arglen cvsgui len cvsgui arg v temp push back std pair std string std string cvsgui arg visual arg if arglen max command line len cvs gui len reached command line limit stop if i 0 tortoise fatal error internal error command line too long to be broken up v temp pop back break my index i else my index 1 set argc argc v temp size fill argv argv new char argc bool args truncated false for i 0 i argc i argv i new char v temp i first size 1 strncpy argv i v temp i first c str v temp i first size 1 if args truncated std string s arg if i 0 arguments s arg v temp i second arguments s arg if arguments length 4096 arguments arguments substr 0 4096 args truncated true makeargs get_next_arguments myargs myargs myindex myindex vtemp myoptions cvsgui_arg visual_arg cvsgui_arg myoptions visual_arg visual_prepare myoptions cvsgui_arg myoptions visual_arg visual_prepare cvsgui_arg cvsgui_len cvsgui_arg vtemp push_back cvsgui_arg visual_arg myargs myindex cvsgui_arg escape_argument myargs myindex visual_arg visual_prepare cvsgui_arg cvsgui_len cvsgui_arg vtemp push_back cvsgui_arg visual_arg max_command_line_len cvs_gui_len tortoisefatalerror _ vtemp pop_back myindex myindex vtemp argstruncated vtemp vtemp c_str vtemp argstruncated sarg sarg vtemp sarg argstruncated std string make args escape argument const std string s std string result s if s find first of 0 result std string result return result makeargs escape_argument find_first_of int make args cvsgui len const std string s int result cvs process encode argument s c str 0 0 1 return result makeargs cvsgui_len cvs_process_encode_argument c_str std string make args visual prepare const std string s int len cvs process encode argument s c str 0 0 char arg char malloc len cvs process encode argument s c str arg len std string result arg free arg find and replace std string result n n find and replace std string result t t if result length 1024 result result substr 0 1024 return result makeargs visual_prepare cvs_process_encode_argument c_str cvs_process_encode_argument c_str findandreplace findandreplace cvs root cvs root const std string cvsroot setcvsroot cvsroot cvsroot cvsroot cvs root cvs root my is modified false cvsroot cvsroot myismodified void cvs root setcvsroot const std string cvsroot my cvs root string cvsroot std string chop cvsroot std string whole protocol root protocol chop crack protocol whole protocol my protocol my protocol parameters my user root user chop my server need server root server chop std string my port root port chop my directory root directory chop my is modified false cvsroot mycvsrootstring wholeprotocol rootprotocol crackprotocol wholeprotocol myprotocol myprotocolparameters myuser rootuser myserver needserver rootserver myport rootport mydirectory rootdirectory myismodified std string cvs root getcvsroot const if my is modified std ostringstream sout sout my protocol if allow protocol parameters my protocol parameters empty sout my protocol parameters sout if allow user my user empty sout my user if need server allow server my server empty sout my server if allow port my port empty sout my port if my directory empty my directory 0 sout sout my directory return sout str else return my cvs root string cvsroot myismodified myprotocol allowprotocolparameters myprotocolparameters myprotocolparameters allowuser myuser myuser needserver allowserver myserver myserver allowport myport myport mydirectory mydirectory mydirectory mycvsrootstring void cvs root clear my protocol my user my server my directory my port cvsroot myprotocol myuser myserver mydirectory myport bool cvs root allow protocol parameters const return my protocol sserver cvsroot allowprotocolparameters myprotocol bool cvs root allow user const return my protocol pserver my protocol ext my protocol ssh my protocol server my protocol sserver my protocol sspi cvsroot allowuser myprotocol myprotocol myprotocol myprotocol myprotocol myprotocol bool cvs root allow port const return my protocol pserver my protocol sspi my protocol gserver my protocol sserver my protocol ssh my protocol ext cvsroot allowport myprotocol myprotocol myprotocol myprotocol myprotocol myprotocol bool cvs root need server const return my protocol local cvsroot needserver myprotocol bool cvs root allow server const return my protocol local cvsroot allowserver myprotocol bool cvs root valid const if my protocol empty return false if need server my server empty return false if my directory empty return false if my protocol parameters empty allow protocol parameters return false return true cvsroot myprotocol needserver myserver mydirectory myprotocolparameters allowprotocolparameters void cvs root set protocol const std string value my protocol value my is modified true cvsroot setprotocol myprotocol myismodified void cvs root set protocol parameters const std string value my protocol parameters value my is modified true cvsroot setprotocolparameters myprotocolparameters myismodified void cvs root set user const std string value my user value my is modified true cvsroot setuser myuser myismodified void cvs root set server const std string value my server value my is modified true cvsroot setserver myserver myismodified void cvs root set directory const std string value my directory value my is modified true cvsroot setdirectory mydirectory myismodified void cvs root set port const std string value my port value my is modified true cvsroot setport myport myismodified std string cvs root get protocol const return my protocol cvsroot getprotocol myprotocol std string cvs root get protocol parameters const return my protocol parameters cvsroot getprotocolparameters myprotocolparameters std string cvs root get user const return my user cvsroot getuser myuser std string cvs root get server const return my server cvsroot getserver myserver std string cvs root get directory const return my directory cvsroot getdirectory mydirectory std string cvs root get port const return my port cvsroot getport myport void cvs root remove trailing delimiter remove trailing delimiter my directory remove trailing delimiter my cvs root string cvsroot removetrailingdelimiter removetrailingdelimiter mydirectory removetrailingdelimiter mycvsrootstring readonly false inline static int compare const entnode data node1 const entnode data node2 return stricmp node1 user c str node2 user c str entnodedata entnodedata c_str c_str inline entnode data un ref void if ref 0 delete this return 0 return this entnodedata unref virtual const char operator int index const if index k name return user c str else if index k status return desc c str return 0 kname c_str kstatus c_str virtual const char operator int index const if index kvn return vn c str else if index kts return ts c str else if index k option return option c str else if index k tag return tag empty date c str tag c str else if index k conflict return ts conflict c str else if index k tag only return tag c str else if index k date only return date c str return entnode data operator index c_str c_str koption c_str ktag c_str c_str kconflict ts_conflict c_str ktagonly c_str kdateonly c_str entnodedata virtual entnode dir delete tagnode entnodedir entnode const entnode anode share data 0 this anode sharedata entnode if share data share data un ref sharedata sharedata unref inline static int compare const entnode node1 const entnode node2 return entnode data compare node1 share data node2 share data entnodedata sharedata sharedata inline entnode operator const entnode anode if share data share data un ref share data 0 if anode share data share data entnode anode share data ref return this sharedata sharedata unref sharedata sharedata sharedata sharedata bool operator const std string s1 const std string s2 const return std lexicographical compare s1 begin s1 end s2 begin s2 end nocase compare lexicographical_compare nocase_compare static bool nocase compare char c1 char c2 return toupper c1 toupper c2 nocase_compare cvs action cvs action tdebug enter cvs action cvs action check for control being pressed again it is also checked when the dialog is first made so people can hold it down while they select a menu item and keep the dialog open if it is if is control down my close setting close never my messages my total std out store empty my total std err store empty if there were lots of operations and one failed remind the user if my errors 0 my uses 1 std string message error one of the cvs operations failed my std err store n message my total std err store n message if my thread safe progress dialog my thread safe progress dialog new text message progress dialog tt error if my progress dialog bring to the front if something especially interesting to say if my errors 0 my progress dialog show true bool close dialog false if my errors if my close setting close if no errors close dialog true else if my close setting close if no messages my messages close dialog true if my close setting close always close dialog true if close dialog my progress dialog wait for abort delete my thread safe progress dialog my thread safe progress dialog null delete progress dialog my progress dialog my progress dialog 0 close console output if my abort event invalid handle value close handle my abort event if my thread event invalid handle value close handle my thread event if my show ui event invalid handle value close handle my show ui event if my show ui finished event invalid handle value close handle my show ui finished event cvsaction cvsaction tdebug_enter cvsaction cvsaction iscontroldown myclosesetting closenever mymessages mytotalstdoutstore mytotalstderrstore myerrors myuses _ mystderrstore mytotalstderrstore mythreadsafeprogressdialog mythreadsafeprogressdialog newtext progressdialog tterror myprogressdialog myerrors myprogressdialog closedialog myerrors myclosesetting closeifnoerrors closedialog myclosesetting closeifnomessages mymessages closedialog myclosesetting closealways closedialog closedialog myprogressdialog waitforabort mythreadsafeprogressdialog mythreadsafeprogressdialog deleteprogressdialog myprogressdialog myprogressdialog closeconsoleoutput myabortevent invalid_handle_value closehandle myabortevent mythreadevent invalid_handle_value closehandle mythreadevent myshowuievent invalid_handle_value closehandle myshowuievent myshowuifinishedevent invalid_handle_value closehandle myshowuifinishedevent bool cvs action command const std string current directory make args args tdebug enter cvs action command if mycvsroot empty mycvsroot cvs status cvs root for path current directory mycvs root holder setcvsroot mycvsroot tdebug trace cvs action command cvsroot mycvs root holder getcvsroot use update 3 for cvsnt 2 0 18 if args main command update cvs server features features features initialize this if features supports three way diffs if 0 args add option 3 endif return internal command current directory args cvsaction currentdirectory makeargs tdebug_enter cvsaction cvsstatus cvsrootforpath currentdirectory mycvsrootholder tdebug_trace cvsaction mycvsrootholder main_command cvsserverfeatures supportsthreewaydiffs add_option internalcommand currentdirectory void cvs action setcvs root const cvs root cvsroot mycvs root holder cvsroot mycvsroot cvsroot getcvsroot cvsaction setcvsroot cvsroot mycvsrootholder void cvs action set password const std string password my password password my password set true cvsaction setpassword mypassword mypasswordset void cvs action set progress caption const std string msg if my progress dialog std string caption msg caption tortoisecvs my progress dialog set caption caption cvsaction setprogresscaption myprogressdialog myprogressdialog setcaption void cvs action set progress finished caption const std string msg if my progress dialog std string caption msg caption tortoisecvs my progress dialog set finished caption caption cvsaction setprogressfinishedcaption myprogressdialog myprogressdialog setfinishedcaption void cvs action set stream file const std string file my streaming to file file delete file my streaming to file c str cvsaction setstreamfile mystreamingtofile deletefile mystreamingtofile c_str void cvs action set close ifok bool close ifok my close setting close ifok close if no errors close never cvsaction setcloseifok closeifok myclosesetting closeifok closeifnoerrors closenever void cvs action set close anyway bool close anyway if close anyway my close setting close always if argument is false restore default setting if close anyway my close setting close always my close setting static cast close t tortoise registry read integer close automatically 3 cvsaction setcloseanyway closeanyway closeanyway myclosesetting closealways closeanyway myclosesetting closealways myclosesetting static_cast close_t tortoiseregistry readinteger void cvs action set hide stdout bool hide my show stdout hide cvsaction sethidestdout myshowstdout void cvs action set silent bool silent my silent silent cvsaction setsilent mysilent cvs action close t cvs action get close const return my close setting cvsaction close_t cvsaction getclose myclosesetting void cvs action set close close t how my close setting how cvsaction setclose close_t myclosesetting void cvs action close console output tdebug enter cvs action close console output if my stream handle invalid handle value close handle my stream handle my stream handle invalid handle value cvsaction closeconsoleoutput tdebug_enter cvsaction closeconsoleoutput mystreamhandle invalid_handle_value closehandle mystreamhandle mystreamhandle invalid_handle_value bool cvs action at least one success return my errors my uses cvsaction atleastonesuccess myerrors myuses bool cvs action aborted return my user aborted cvsaction myuseraborted std string cvs action get std out return my std out store cvsaction getstdout mystdoutstore std string cvs action get std err return my std err store cvsaction getstderr mystderrstore std string cvs action get output return my output store cvsaction getoutput myoutputstore void cvs action lock progress dialog bool lock tdebug enter cvs action lock progress dialog if my thread safe progress dialog my thread safe progress dialog lock lock cvsaction lockprogressdialog tdebug_enter cvsaction lockprogressdialog mythreadsafeprogressdialog mythreadsafeprogressdialog progress dialog cvs action get progress dialog return my progress dialog progressdialog cvsaction getprogressdialog myprogressdialog bool cvs action internal command const std string current directory make args args tdebug enter cvs action internal command bool ret bool repeat int my errors old my errors if is unix sandbox current directory args add global option lf do repeat false ret do command current directory args tdebug trace after do command if my user aborted break const std string repository directory failure std string tortoise tip sometimes you get this error if you have the repository folder wrong in the checkout dialog make sure you have a slash at the start of the folder name and that the case and path are correct watch out for spurious trailing characters n n examples are cvsroot usr local cvs repository cvsroot cvsgui n look for instructions to run cvs login and ask for their password if needs login tdebug trace user not logged in my errors not a real error as we hook it determine which server we need to log in to std string directory current directory std string size type rejected pos my std err store find cvsparse rejected access if rejected pos std string npos const char server string server std string size type server pos my std err store find cvsparse server string if server pos std string npos skip to start of server name server pos strlen server string std string server name my std err store substr server pos rejected pos server pos tdebug trace server name server name directory cvs status recursive find root current directory server name tdebug trace directory directory make args login args login args add option login my login cancelled false repeat true do ret do command directory login args if my login cancelled repeat false break if ret if needs login repeat false break else repeat true break my errors while true delete streaming file we don t want data from login etc only from the operations performed successfully if my streaming to file empty delete file my streaming to file c str if sspi fails because encryption is not supported on linux try again with encryption disabled if my errors my std err store find cvsparse end of file from server 0 std string npos mycvs root holder get protocol sspi my disable sspi encryption tortoise registry read boolean disablesspi encryption mycvs root holder get server false encryption is not disabled for this server my errors not a real error as we hook it my disable sspi encryption true if my streaming to file empty delete file my streaming to file c str if my progress dialog my progress dialog new text retrying command with encryption disabled progress dialog tt tip repeat true else check if the retry succeeded if my disable sspi encryption tortoise registry write boolean disablesspi encryption mycvs root holder get server true my disable sspi encryption false look for instructions to cvs init and give them the option if my errors my std err store find cvsparse cvsroot no such file or directory 0 std string npos my std err store find cvsparse cvsroot n no such file or directory 0 std string npos tdebug trace need to call cvs init my errors not a real error as we hook it std string message if mycvs root holder allow server mycvs root holder get server empty message printf there is no cvs repository in this folder n n s on s mycvs root holder get directory c str mycvs root holder get server c str else message printf there is no cvs repository in this folder n n s mycvs root holder get directory c str message n n message if this is the wrong folder correct it and try again if you want to initialise a new repository with cvs init then check the box below and tortoisecvs will try again if do check query dialog my progress dialog message false initialise a new repository here makes a cvsroot folder make args init args init args add option init ret do command current directory init args if ret my errors repeat true else set close ifok false if my progress dialog my progress dialog new text repository directory failure progress dialog tt tip delete streaming file we don t want data from login etc only from the operations performed successfully if my streaming to file empty delete file my streaming to file c str if bad lock server version my progress dialog my progress dialog new text tortoise tip apparently you are using the local protocol and you have and older version of cvsnt installed than the one included with tortoisecvs to resolve this problem do one of the following n 1 don t use local add the repository to your local cvsnt server n control panel cvs for nt repositories and use a network protocol n e g pserver or sspi to access the repository n this requires a fresh checkout n 2 remove your local cvsnt server installation if you don t need it n 3 update your local cvsnt server installation to version 2 0 62 1817 progress dialog tt tip while repeat tdebug trace after the loop clear other stuff so values don t confuse if we reuse cvs action later mycvsroot mycvs root holder clear my streaming to file my show stdout true tdebug trace after clearing if my silent my errors my errors old play error sound tdebug trace after sound return ret cvsaction internalcommand currentdirectory makeargs tdebug_enter cvsaction internalcommand myerrorsold myerrors isunixsandbox currentdirectory add_global_option docommand currentdirectory tdebug_trace docommand myuseraborted repositorydirectoryfailure _ needslogin tdebug_trace myerrors currentdirectory size_type rejectedpos mystderrstore rejectedpos serverstring size_type serverpos mystderrstore serverstring serverpos serverpos serverstring servername mystderrstore serverpos rejectedpos serverpos tdebug_trace servername servername cvsstatus recursivefindroot currentdirectory servername tdebug_trace makeargs loginargs loginargs add_option mylogincancelled docommand loginargs mylogincancelled needslogin myerrors mystreamingtofile deletefile mystreamingtofile c_str myerrors mystderrstore mycvsrootholder getprotocol mydisablesspiencryption tortoiseregistry readboolean disablesspiencryption mycvsrootholder getserver myerrors mydisablesspiencryption mystreamingtofile deletefile mystreamingtofile c_str myprogressdialog myprogressdialog newtext _ progressdialog tttip mydisablesspiencryption tortoiseregistry writeboolean disablesspiencryption mycvsrootholder getserver mydisablesspiencryption myerrors mystderrstore mystderrstore nno tdebug_trace myerrors mycvsrootholder allowserver mycvsrootholder getserver _ mycvsrootholder getdirectory c_str mycvsrootholder getserver c_str _ mycvsrootholder getdirectory c_str _ docheckquerydialog myprogressdialog _ makeargs initargs initargs add_option docommand currentdirectory initargs myerrors setcloseifok myprogressdialog myprogressdialog newtext repositorydirectoryfailure progressdialog tttip mystreamingtofile deletefile mystreamingtofile c_str badlockserverversion myprogressdialog myprogressdialog newtext _ progressdialog tttip tdebug_trace cvsaction mycvsrootholder mystreamingtofile myshowstdout tdebug_trace mysilent myerrors myerrorsold playerrorsound tdebug_trace bool cvs action do command const std string current directory make args args tdebug enter do command my thread directory current directory my thread args args new stuff for the thread my thread signal new work make sure the dialog responds and wait until the thread is done if my thread safe progress dialog tdebug trace main loop while my thread safe progress dialog main my show ui event handle ui event reset event my show ui event set event my show ui finished event else handle handles 2 my thread event my show ui event dword wait result 0 tdebug trace wait for thread end do wait result wait for multiple objects 2 handle handles false infinite if wait result wait object 0 1 handle ui event reset event my show ui event set event my show ui finished event while wait result wait object 0 1 return my thread result cvsaction docommand currentdirectory makeargs tdebug_enter docommand mythreaddirectory currentdirectory mythreadargs mythread signalnewwork mythreadsafeprogressdialog tdebug_trace mythreadsafeprogressdialog myshowuievent handleuievent resetevent myshowuievent setevent myshowuifinishedevent mythreadevent myshowuievent waitresult tdebug_trace waitresult waitformultipleobjects waitresult wait_object_0 handleuievent resetevent myshowuievent setevent myshowuifinishedevent waitresult wait_object_0 mythreadresult bool cvs action do command thread const std string current directory make args args tdebug enter cvs action do command thread prevent more than one at once as the progress dialog can t cope with it if my in use tortoise fatal error internal error cvs action do command used twice within same process my in use true my user aborted false bool ret false my std err store my std out store my output store std string old error my std err store int result 0 m mapenvvars clear m mapenvvars user mycvs root holder get user m mapenvvars logname mycvs root holder get user std string scvsread get env var cvsread if scvsread empty m mapenvvars cvsread scvsread if mycvsroot empty m mapenvvars cvsroot mycvsroot else m mapenvvars cvsroot get env var cvsroot if mycvs root holder get protocol server mycvs root holder get protocol ext mycvs root holder get server empty m mapenvvars cvs server mycvs root holder get server std string s env var get env var temp if s env var empty m mapenvvars temp s env var s env var get env var tmp if s env var empty m mapenvvars tmp s env var set envvars for ext protocol std string login application tortoise registry read string external ssh application tortoise plink std string login params tortoise registry read string external ssh params l u h std string login string if login application empty login string login application else login string ensure trailing delimiter get tortoise directory tortoise plink exe if login params empty login string login params set env var plink protocol ssh tdebug trace login string login string set env var cvs ext login string char buf 20 if my progress dialog snprintf buf sizeof buf d get hwnd of my progress dialog else snprintf buf sizeof buf d get remote handle if strlen buf set env var tcvs hwnd buf if tortoise registry read boolean client log false m mapenvvars cvs client log get tortoise directory cvsclient log std string home dir get home directory home dir m mapenvvars home home dir override cvs network share error if mycvs root holder get protocol local tortoise registry read boolean allow network drives false args add global option n instruct cvs to use data encryption x on protocols that supports it unless disabled in the registry currently sspi crashes on win98 with x so we work around that bool use encryption false if mycvs root holder get protocol sspi windows platform isnt if tortoise registry read boolean data encryption true encryption not disabled in registry my disable sspi encryption not retrying ssp without encryption tortoise registry read boolean disablesspi encryption encryption not permanently disabled mycvs root holder get server for this server false use encryption true if mycvs root holder get protocol gserver tortoise registry read boolean data encryption true use encryption true if use encryption args add global option x now break the command line into manageable chunks to avoid breaking the command line length limit my user aborted false while my user aborted std string arguments unsigned int argc char argv args get next arguments argc argv arguments if argc 0 break if my streaming to file empty my stream handle create file my streaming to file c str generic read generic write file share read file share write null create always file attribute normal file flag write through null tdebug trace command arguments if my thread safe progress dialog std string what doing printf in s s ncvsroot s current directory c str arguments c str mycvsroot c str what doing n n my thread safe progress dialog new text what doing progress dialog tt noise cvs process startup info startup info startup info has tty 0 startup info current directory current directory c str my cvs process cvs process run argv 0 argc 1 argv 1 s call table startup info this for unsigned int i 0 i argc i delete argv i delete argv if my cvs process if my flags silent on error result 1 break std string msg std string s1 if the command line is very long the message box can become larger than the screen we want to avoid that if arguments length 1024 s1 arguments substr 0 1024 else s1 arguments msg printf trouble launching the cvs process n s n on folder s n s n please check there is a cvs exe in the same folder as tortoisecvs or on the path s1 c str current directory c str get win error msg get last error c str tortoise fatal error msg else tdebug trace started cvs process my current stderr pos my current stdout pos 0 while true tdebug trace pipe loop if wait for single object my abort event 200 wait object 0 tdebug trace stopping cvs my user aborted true cvs process stop my cvs process tdebug trace stopped cvs pipe togui if cvs process is active my cvs process tdebug trace process not active break make sure all text is written to progress dialog flush togui result my exit code tdebug trace done error codes for diff are stuffed 1 means there was a difference so we fudge our own more useful ones based on if the cvs operation wrote to stderr if args main command diff result 0 if old error my std err store ok it might look as if there were differences but we have to handle some special cases yikes 1 for some reason there might be an empty line written to stderr 2 if cvsroot specifies user anonymous we might get the message cvs diff server empty password used try cvs login with a real password 3 if the user has added but un committed files we will get cvs diff server file is a new entry no comparison available 4 if the user has removed but un committed files we will get cvs diff server file was removed no comparison available split output into lines std istringstream is my std err store std string line while std getline is line accept empty lines std string size type x if x line find first not of r n std string npos continue accept login message if line find cvsparse empty password used try cvs login with a real password std string npos continue accept new entry message if line find cvsparse is a new entry no comparison available std string npos continue accept was removed message if line find cvsparse was removed no comparison available std string npos continue everything else means trouble result 1 break this is fixed in cvsnt but as it s a server issue we need this workaround else if args main command remove if old error my std err store split output into lines std istringstream is my std err store std string line while std getline is line look for errors if line find cvsparse cvs server cannot remove file 0 line find cvsparse cvs remove cannot remove file 0 cvsaction docommandthread currentdirectory makeargs tdebug_enter cvsaction docommandthread myinuse tortoisefatalerror _ cvsaction docommand myinuse myuseraborted mystderrstore mystdoutstore myoutputstore olderror mystderrstore m_mapenvvars m_mapenvvars mycvsrootholder getuser m_mapenvvars mycvsrootholder getuser getenvvar m_mapenvvars m_mapenvvars m_mapenvvars getenvvar mycvsrootholder getprotocol mycvsrootholder getprotocol mycvsrootholder getserver m_mapenvvars cvs_server mycvsrootholder getserver senvvar getenvvar senvvar m_mapenvvars senvvar senvvar getenvvar senvvar m_mapenvvars senvvar loginapplication tortoiseregistry readstring tortoiseplink loginparams tortoiseregistry readstring loginstring loginapplication loginstring loginapplication loginstring ensuretrailingdelimiter gettortoisedirectory tortoiseplink loginparams loginstring loginparams setenvvar plink_protocol tdebug_trace loginstring loginstring setenvvar cvs_ext loginstring myprogressdialog _snprintf gethwndof myprogressdialog _snprintf getremotehandle setenvvar tcvs_hwnd tortoiseregistry readboolean m_mapenvvars cvs_client_log gettortoisedirectory homedir gethomedirectory homedir m_mapenvvars homedir mycvsrootholder getprotocol tortoiseregistry readboolean add_global_option useencryption mycvsrootholder getprotocol windowsplatformisnt tortoiseregistry readboolean mydisablesspiencryption tortoiseregistry readboolean disablesspiencryption mycvsrootholder getserver useencryption mycvsrootholder getprotocol tortoiseregistry readboolean useencryption useencryption add_global_option myuseraborted myuseraborted get_next_arguments mystreamingtofile mystreamhandle createfile mystreamingtofile c_str generic_read generic_write file_share_read file_share_write create_always file_attribute_normal file_flag_write_through tdebug_trace mythreadsafeprogressdialog whatdoing _ currentdirectory c_str c_str c_str whatdoing mythreadsafeprogressdialog newtext whatdoing progressdialog ttnoise cvsprocessstartupinfo startupinfo startupinfo hastty startupinfo currentdirectory currentdirectory c_str mycvsprocess cvs_process_run scalltable startupinfo mycvsprocess myflags silent_on_error _ non c_str currentdirectory c_str getwinerrormsg getlasterror c_str tortoisefatalerror tdebug_trace mycurrentstderrpos mycurrentstdoutpos tdebug_trace waitforsingleobject myabortevent wait_object_0 tdebug_trace myuseraborted cvs_process_stop mycvsprocess tdebug_trace pipetogui cvs_process_is_active mycvsprocess tdebug_trace flushtogui myexitcode tdebug_trace main_command olderror mystderrstore mystderrstore size_type find_first_not_of main_command olderror mystderrstore mystderrstore void cvs action thread main while my thread wait for more work my thread result do command thread my thread directory my thread args this signals thread safe progress main to exit its loop if my thread safe progress dialog my thread safe progress dialog finished else set event my thread event cvsaction threadmain mythread waitformorework mythreadresult docommandthread mythreaddirectory mythreadargs threadsafeprogress mythreadsafeprogressdialog mythreadsafeprogressdialog setevent mythreadevent std string cvs action handle user input std string cvs output tdebug enter cvs action handle user input std string size type pos int p current position my current stdout pos cvs edit s has been modified revert changes tdebug trace handle user input cvs output tdebug trace handle user input curpos p current position pos cvs output find cvsparse has been modified revert changes p current position tdebug trace handle user input pos pos if pos std string npos make sure all text is written to progress dialog flush togui std string size type endpos pos find start of line while pos cvs output pos n pos if cvs output pos n pos extract file name std string filename cvs output substr pos endpos pos 1 std string msg printf s has been modified do you want to discard your local changes and revert to the most current version in the repository n select yes to discard your changes or no to cancel the unedit command take no action filename c str std string response hwnd hwnd parent 0 if my progress dialog hwnd parent get hwnd of my progress dialog if message box hwnd parent msg c str mb iconquestion mb yesno mb defbutton2 idyes response y else response n find end of message cvs output n while endpos cvs output size cvs output endpos endpos tdebug trace handle user input endpos endpos p current position endpos return response cvs release are you sure you want to release sdirectory s not actually used yet pos cvs output find cvsparse are you sure you want to release p current position if pos std string npos std string message you have altered files in this repository see the main tortoisecvs dialog for details n do you want to discard your local changes n select yes to discard your changes or no to cancel the release command take no action std string response hwnd hwnd parent 0 if my progress dialog hwnd parent get hwnd of my progress dialog if message box hwnd parent message c str mb iconquestion mb yesno mb defbutton2 idyes response y else response n p current position pos 1 return response ssh protocol adding server s fingerprint to registry pos cvs output find cvsparse the server s key fingerprint is p current position if pos std string npos make sure all text is written to progress dialog flush togui std string size type endpos pos find start of line while pos cvs output pos n pos if cvs output pos n pos find end of line std string size type pos2 pos while pos2 cvs output pos2 n pos2 extract server key std string key cvs output substr pos pos2 pos std string msg printf the server s host key is not cached in the registry n key fingerprint s n if you trust this host hit yes to add the key to the cache n if you want to connect just once hit no n if you don t trust this host hit cancel n key c str std string response hwnd hwnd parent 0 if my progress dialog hwnd parent get hwnd of my progress dialog int r message box hwnd parent msg c str mb iconquestion mb yesnocancel mb defbutton3 if r idyes response y else if r idno response n else response c return response return cvsaction handleuserinput cvsoutput tdebug_enter cvsaction handleuserinput size_type pcurrentposition mycurrentstdoutpos tdebug_trace handleuserinput cvsoutput tdebug_trace handleuserinput pcurrentposition cvsoutput pcurrentposition tdebug_trace handleuserinput flushtogui size_type cvsoutput cvsoutput cvsoutput _ c_str hwndparent myprogressdialog hwndparent gethwndof myprogressdialog messagebox hwndparent c_str mb_iconquestion mb_yesno mb_defbutton2 cvsoutput cvsoutput cvsoutput tdebug_trace handleuserinput pcurrentposition cvsoutput pcurrentposition _ hwndparent myprogressdialog hwndparent gethwndof myprogressdialog messagebox hwndparent c_str mb_iconquestion mb_yesno mb_defbutton2 pcurrentposition cvsoutput pcurrentposition flushtogui size_type cvsoutput cvsoutput size_type cvsoutput cvsoutput _ nkey c_str hwndparent myprogressdialog hwndparent gethwndof myprogressdialog messagebox hwndparent c_str mb_iconquestion mb_yesnocancel mb_defbutton3 void cvs action handle ui event if my show ui command show password dialog get password data data get password data my show ui data if do login dialog my progress dialog data password data do cancel true else data do cancel false cvsaction handleuievent myshowuicommand showpassworddialog getpassworddata getpassworddata myshowuidata dologindialog myprogressdialog docancel docancel bool cvs action needs login const return my errors my std err store find cvsparse authentication failed 0 std string npos this one for sspi my std err store find cvsparse authentication failed 0 std string npos my std err store find cvsparse authorization failed 0 std string npos my std err store find cvsparse authentication protocol rejected access 0 std string npos my std err store find cvsparse unrecognized auth response 0 std string npos my std err store find cvsparse no such user 0 std string npos cvsaction needslogin myerrors mystderrstore mystderrstore mystderrstore mystderrstore mystderrstore mystderrstore bool cvs action bad lock server version const return my errors my std err store find cvsparse invalid lockserver version 0 std string npos cvsaction badlockserverversion myerrors mystderrstore void cvs action pipe togui cs helper cs m csoutput true std string text m bufvisualoutput m bufvisualoutput erase unsigned int length text length if length 0 ok this code is starting to get hairy what we want to do is this 1 split what we got up into lines so that new text can do its colouring magic 2 if we have an incomplete line at the end of the loop save it for next time round std string size type start end start 0 do end text find first of r n start if end std string npos got an incomplete line save it and exit m bufvisualoutput text substr start break skip line endings while text end r text end n end if start end my thread safe progress dialog my thread safe progress dialog new text text substr start end start start end while end length cvsaction pipetogui cshelper m_csoutput m_bufvisualoutput m_bufvisualoutput newtext size_type find_first_of m_bufvisualoutput mythreadsafeprogressdialog mythreadsafeprogressdialog newtext void cvs action flush togui cs helper cs m csoutput true std string text m bufvisualoutput cs leave if text empty my thread safe progress dialog my thread safe progress dialog new text text cvsaction flushtogui cshelper m_csoutput m_bufvisualoutput mythreadsafeprogressdialog mythreadsafeprogressdialog newtext long cvs action console out char txt long len std string message txt len if len 0 my stream is binary true else remove all r s to prevent r r n sequences since windows text controls seem to ignore them i e don t break the line at all find and replace std string message r find and replace std string message n r n my stream is binary false if message length 0 are we writing to a stream file if my stream handle invalid handle value dword dw written if my stream is binary write file my stream handle txt len dw written 0 else write file my stream handle message c str message length dw written 0 else if my flags pipe stdout my std out store message my total std out store message my output store message else cs helper cs m csoutput true if my show stdout m bufvisualoutput message my std out store message my total std out store message my output store message return len cvsaction consoleout mystreamisbinary findandreplace findandreplace mystreamisbinary mystreamhandle invalid_handle_value dwwritten mystreamisbinary writefile mystreamhandle dwwritten writefile mystreamhandle c_str dwwritten myflags pipe_stdout mystdoutstore mytotalstdoutstore myoutputstore cshelper m_csoutput myshowstdout m_bufvisualoutput mystdoutstore mytotalstdoutstore myoutputstore long cvs action console err char txt long len std string message txt len if message length 0 cs helper cs m csoutput true my std err store message my total std err store message my output store message m bufvisualoutput message return len cvsaction consoleerr cshelper m_csoutput mystderrstore mytotalstderrstore myoutputstore m_bufvisualoutput const char cvs action get env char name static char buf 32768 std string s name name std map std string std string iterator it m mapenvvars find s name if it m mapenvvars end strncpy buf it second c str sizeof buf return buf else if s name cvs getpass pipe togui if my password set strncpy buf my password c str sizeof buf return buf else get password data data my show ui command show password dialog my show ui data data set event my show ui event wait for single object my show ui finished event infinite reset event my show ui finished event my login cancelled data do cancel if data do cancel strncpy buf data password c str sizeof buf return buf else return 0 else if s name cvslib yesno pipe togui std string s response handle user input my std out store strncpy buf s response c str sizeof buf flush togui return buf else return 0 cvsaction getenv sname m_mapenvvars sname m_mapenvvars c_str sname cvs_getpass pipetogui mypasswordset mypassword c_str getpassworddata myshowuicommand showpassworddialog myshowuidata setevent myshowuievent waitforsingleobject myshowuifinishedevent resetevent myshowuifinishedevent mylogincancelled docancel docancel c_str sname cvslib_yesno pipetogui sresponse handleuserinput mystdoutstore sresponse c_str flushtogui m versionrelease 0 m versionpatch 0 if version empty parse version string version m_versionrelease m_versionpatch parseversionstring std string cvs status cvs version info as string std string str if m isvalid return str if m iscvsnt str cvsnt else str cvs char buf 100 write major and minor version sprintf buf d d m versionmajor m versionminor str buf if m versionrelease 0 sprintf buf d m versionrelease str buf if m versionpatch 0 sprintf buf p d m versionpatch str buf return str cvsstatus cvsversioninfo asstring m_isvalid m_iscvsnt m_versionmajor m_versionminor m_versionrelease m_versionrelease m_versionpatch m_versionpatch void cvs status cvs version info parse version string const std string str m isvalid false m versionmajor 1 m versionminor 1 m versionrelease 1 m versionpatch 1 check if it s cvsnt m iscvsnt str find cvsnt std string npos find the first digit of the version number std string size type p str find first of 0123456789 if p std string npos return read the major version number std string size type p0 p while isdigit str p p if p p0 return m versionmajor atoi str substr p0 p p0 c str if str p return read the minor version number p p0 p while isdigit str p p if p p0 return m versionminor atoi str substr p0 p p0 c str m isvalid true if str p return read release version number p p0 p while isdigit str p p if p p0 return m versionrelease atoi str substr p0 p p0 c str if str p p return read patch version number p p0 p while isdigit str p p if p p0 return m versionpatch atoi str substr p0 p p0 c str cvsstatus cvsversioninfo parseversionstring m_isvalid m_versionmajor m_versionminor m_versionrelease m_versionpatch m_iscvsnt size_type find_first_of size_type m_versionmajor c_str m_versionminor c_str m_isvalid m_versionrelease c_str m_versionpatch c_str void cvs status cvs version info set unknown m iscvsnt false m isvalid true m versionmajor 0 m versionminor 0 m versionrelease 0 m versionpatch 1 cvsstatus cvsversioninfo setunknown m_iscvsnt m_isvalid m_versionmajor m_versionminor m_versionrelease m_versionpatch bool cvs status cvs version info operator const cvs version info op const if m versionmajor op version major return true if m versionmajor op version major m versionminor op version minor return true if m versionmajor op version major m versionminor op version minor m versionrelease op version release return true if m versionmajor op version major m versionminor op version minor m versionrelease op version release m versionpatch op version patch return true return false cvsstatus cvsversioninfo cvsversioninfo m_versionmajor versionmajor m_versionmajor versionmajor m_versionminor versionminor m_versionmajor versionmajor m_versionminor versionminor m_versionrelease versionrelease m_versionmajor versionmajor m_versionminor versionminor m_versionrelease versionrelease m_versionpatch versionpatch bool cvs status cvs version info operator const cvs version info op const return m versionmajor op version major m versionminor op version minor m versionrelease op version release m versionpatch op version patch cvsstatus cvsversioninfo cvsversioninfo m_versionmajor versionmajor m_versionminor versionminor m_versionrelease versionrelease m_versionpatch versionpatch m filename filename m status status m_filename m_status time stamp 0 time stamp def ign list 0 entnode cache entnode data cache size timestamp timestampdefignlist entnodecache entnode_data_cache_size cvs status file status cvs status get file status const std string filename tdebug enter cvs status get file status tdebug trace filename cvs status file status status status incvs rw check for special case of the outer directory if is outer directory filename tdebug trace outer dir status status outerdirectory else tdebug trace initialize cs helper cs helper cs tdebug trace before get entnode data entnode data data get entnode data filename cs tdebug trace before get file status status get file status data return status cvsstatus filestatus cvsstatus getfilestatus tdebug_enter cvsstatus getfilestatus tdebug_trace cvsstatus filestatus status_incvs_rw isouterdirectory tdebug_trace outerdir status_outerdirectory tdebug_trace cshelper cshelper tdebug_trace getentnodedata entnodedata getentnodedata tdebug_trace getfilestatus getfilestatus cvs status file status cvs status get file status entnode data data tdebug enter cvs status get file status cvs status file status status status incvs rw if data tdebug trace data empty status status nowherenear cvs else tdebug trace data not empty if data is ignored tdebug trace ignored status status ignored else if data is unknown tdebug trace not in cvs status status notincvs else if data is removed tdebug trace removed status status removed else if data is missing tdebug trace missing status status missing else if data is unmodified if data is read only tdebug trace in cvs read only status status incvs ro else tdebug trace in cvs status status incvs rw else if data needs merge tdebug trace conflict status status conflict else if data is added tdebug trace added status status added else tdebug trace changed status status changed return status cvsstatus filestatus cvsstatus getfilestatus entnodedata tdebug_enter cvsstatus getfilestatus cvsstatus filestatus status_incvs_rw tdebug_trace status_nowherenear_cvs tdebug_trace isignored tdebug_trace status_ignored isunknown tdebug_trace status_notincvs isremoved tdebug_trace status_removed ismissing tdebug_trace status_missing isunmodified isreadonly tdebug_trace status_incvs_ro tdebug_trace status_incvs_rw needsmerge tdebug_trace status_conflict isadded tdebug_trace status_added tdebug_trace status_changed int levels tdebug enter cvs status get file status recursive check if it is in the cache our rec status cache data p data 0 cs helper cs our rec statuscs true p data our rec status cache find filename if p data check if cache value is not too old if get tick count p data time stamp recursive status cache expiration return p data status fetch new value if p data p data our rec status cache insert filename p data status get file status recursive uncached filename status levels p data time stamp get tick count return p data status tdebug_enter cvsstatus getfilestatusrecursive ourrecstatuscachedata pdata cshelper ourrecstatuscs pdata ourrecstatuscache pdata gettickcount pdata timestamp recursive_status_cache_expiration pdata pdata pdata ourrecstatuscache pdata getfilestatusrecursiveuncached pdata timestamp gettickcount pdata std vector scan data scandata bool recurse tdebug enter cvs status scan entries tdebug trace scan entries directory cs helper cs dir std vector std string dirs std vector std string const iterator it entnode map const iterator ite entnode dir data dir data get entnode dir data directory cs dir if dir data return for ite dir data entries begin ite dir data entries end ite std string filename ensure trailing delimiter directory ite first if is directory filename c str recurse dirs push back filename entnode data node data get entnode data uncached filename dir data scandata push back scan data filename get file status node data cs dir leave for it dirs begin it dirs end it scan entries it scandata recurse scandata tdebug_enter cvsstatus scanentries tdebug_trace scanentries cshelper csdir const_iterator entnodemap const_iterator entnodedirdata dirdata getentnodedirdata csdir dirdata dirdata dirdata ensuretrailingdelimiter isdirectory c_str push_back entnodedata nodedata getentnodedatauncached dirdata push_back scandata getfilestatus nodedata csdir scanentries bool scan dir ignored tdebug enter cvs status recursive needs adding tdebug trace dir scan directory bool include ignored tortoise registry read boolean add ignored files false first make sure that we do not ever add a cvs directory std string last part extract last part scan directory if stricmp last part c str cvs return add ourself file status status get file status scan directory we need to add even if nowhere near cvs as directories inside directories come under that category if status status notincvs status status nowherenear cvs status status ignored if include folders include ignored status status ignored files push back scan directory ignored push back status status ignored scan dir ignored if status status ignored include ignored return if is directory scan directory c str tdebug trace not a folder return cs helper cs dir entnode dir data dir data get entnode dir data scan directory cs dir std vector std string ign list if dir data build ignored list ign list scan directory 0 0 add our child files or call recursively for child directories std vector std string children std vector std string dirs std vector bool dirs ignored std vector std string const iterator it std vector bool const iterator it ign get directory contents scan directory children children for unsigned int i 0 i children size i std string filename ensure trailing delimiter scan directory children i std string justfilename extract last part filename std string directory get directory above filename if dir data this directory is in cvs entnode data data get entnode data uncached filename dir data if data continue if stricmp justfilename c str cvs 0 continue if is directory filename c str dirs push back filename dirs ignored push back data is ignored else if is system file filename c str if data is unknown files push back filename ignored push back data is ignored else the parent directory is not in cvs add everything except files matching cvsignore bool match ignored match ignored list justfilename c str ign list if include ignored match ignored if is directory filename c str dirs push back filename dirs ignored push back match ignored else if is system file filename c str files push back filename ignored push back match ignored cs dir leave for it dirs begin it ign dirs ignored begin it dirs end it it ign recursive needs adding it files ignored include folders it ign scandirignored tdebug_enter cvsstatus recursiveneedsadding tdebug_trace scandirectory includeignored tortoiseregistry readboolean lastpart extractlastpart scandirectory lastpart c_str filestatus getfilestatus scandirectory status_notincvs status_nowherenear_cvs status_ignored includefolders includeignored status_ignored push_back scandirectory push_back status_ignored scandirignored status_ignored includeignored isdirectory scandirectory c_str tdebug_trace cshelper csdir entnodedirdata dirdata getentnodedirdata scandirectory csdir ignlist dirdata buildignoredlist ignlist scandirectory dirsignored const_iterator const_iterator itign getdirectorycontents scandirectory ensuretrailingdelimiter scandirectory extractlastpart getdirectoryabove dirdata entnodedata getentnodedatauncached dirdata c_str isdirectory c_str push_back dirsignored push_back isignored issystemfile c_str isunknown push_back push_back isignored matchignored matchignoredlist c_str ignlist includeignored matchignored isdirectory c_str push_back dirsignored push_back matchignored issystemfile c_str push_back push_back matchignored csdir itign dirsignored itign recursiveneedsadding includefolders itign std vector std string conflict std vector scan data scandata std vector scan data iterator it get all entries in entries file if is directory directory c str scan entries directory scandata true else scandata push back scan data directory cvs status get file status directory for it scandata begin it scandata end it we never return directories if is directory it m filename c str continue modified files if modified if it m status status changed modified push back it m filename added files if added if it m status status added added push back it m filename removed files if removed if it m status status removed removed push back it m filename unmodified files if unmodified if it m status status incvs ro it m status status incvs rw unmodified push back it m filename writable files if writable if it m status status incvs rw writable push back it m filename if conflict if it m status status conflict conflict push back it m filename scandata scandata isdirectory c_str scanentries push_back scandata cvsstatus getfilestatus isdirectory m_filename c_str m_status status_changed push_back m_filename m_status status_added push_back m_filename m_status status_removed push_back m_filename m_status status_incvs_ro m_status status_incvs_rw push_back m_filename m_status status_incvs_rw push_back m_filename m_status status_conflict push_back m_filename int levels bool persist tdebug enter cvs status get directory status iterate through all directories win32 find data fd std string my dir std string my entry file status my dir status status incvs rw file status my dir status rec status incvs rw file status entry status file status entry status rec entnode dir data dir data 0 entnode data node data 0 cs helper cs dir data cs helper cs node entnode map const iterator ite std vector std string dirs files std vector file status v dir status std vector file status const iterator its std vector std string const iterator it handle h find invalid handle value tdebug trace scan directory dirname my dir ensure trailing delimiter dirname h find find first file my dir c str fd if h find invalid handle value goto cleanup do ignore directories and cvs if stricmp fd c file name 0 stricmp fd c file name 0 stricmp fd c file name cvs 0 continue my entry ensure trailing delimiter dirname fd c file name if fd dw file attributes file attribute directory dirs push back my entry else files push back my entry while find next file h find fd find close h find h find invalid handle value get dir data dir data get entnode dir data dirname cs dir data if dir data 0 goto cleanup cs node attach dir data entnode cachecs cs node enter process files tdebug trace process files for it files begin it files end it tdebug trace file it node data get entnode data it dir data cs node entry status get file status node data combine with current directory status my dir status get combined overlay status my dir status entry status process entries file tdebug trace process entries for ite dir data entries begin ite dir data entries end ite std string filename ensure trailing delimiter dirname ite first tdebug trace entry filename entnode data node data get entnode data filename dir data cs node my dir status get combined overlay status my dir status get file status node data my dir status rec my dir status process directories tdebug trace process directories for it dirs begin it dirs end it tdebug trace directory it node data get entnode data it dir data cs node entry status get file status node data v dir status push back entry status cs node leave cs dir data leave for it dirs begin its v dir status begin it dirs end its v dir status end it its entry status its entry status rec its if its status incvs rw its status incvs ro its status outerdirectory if levels 0 get directory status it 0 entry status rec levels 0 levels 1 1 persist my dir status get combined overlay status my dir status entry status my dir status rec get combined overlay status my dir status rec entry status rec if persist file status old dir status file status old dir status rec tortoise directory status dir status dirname save directory status in status file dir status load old dir status dir status get dir status old dir status rec dir status get dir status rec tdebug trace old status old dir status rec old dir status rec tdebug trace new status my dir status rec my dir status rec dir status set dir status my dir status dir status set dir status rec my dir status rec dir status save notify the shell if old dir status rec my dir status rec shell notify update file dirname cleanup if h find invalid handle value find close h find if dir status dir status my dir status if dir status rec dir status rec my dir status rec tdebug_enter cvsstatus getdirectorystatus win32_find_data mydir myentry filestatus mydirstatus status_incvs_rw filestatus mydirstatusrec status_incvs_rw filestatus entrystatus filestatus entrystatusrec entnodedirdata dirdata entnodedata nodedata cshelper csdirdata cshelper csnode entnodemap const_iterator filestatus vdirstatus filestatus const_iterator const_iterator hfind invalid_handle_value tdebug_trace mydir ensuretrailingdelimiter hfind findfirstfile mydir c_str hfind invalid_handle_value cfilename cfilename cfilename myentry ensuretrailingdelimiter cfilename dwfileattributes file_attribute_directory push_back myentry push_back myentry findnextfile hfind findclose hfind hfind invalid_handle_value dirdata getentnodedirdata csdirdata dirdata csnode dirdata entnodecachecs csnode tdebug_trace tdebug_trace nodedata getentnodedata dirdata csnode entrystatus getfilestatus nodedata mydirstatus getcombinedoverlaystatus mydirstatus entrystatus tdebug_trace dirdata dirdata ensuretrailingdelimiter tdebug_trace entnodedata nodedata getentnodedata dirdata csnode mydirstatus getcombinedoverlaystatus mydirstatus getfilestatus nodedata mydirstatusrec mydirstatus tdebug_trace tdebug_trace nodedata getentnodedata dirdata csnode entrystatus getfilestatus nodedata vdirstatus push_back entrystatus csnode csdirdata vdirstatus vdirstatus entrystatus entrystatusrec status_incvs_rw status_incvs_ro status_outerdirectory getdirectorystatus entrystatusrec mydirstatus getcombinedoverlaystatus mydirstatus entrystatus mydirstatusrec getcombinedoverlaystatus mydirstatusrec entrystatusrec filestatus olddirstatus filestatus olddirstatusrec tortoisedirectorystatus dirstatus dirstatus olddirstatus dirstatus getdirstatus olddirstatusrec dirstatus getdirstatusrec tdebug_trace olddirstatus olddirstatusrec tdebug_trace mydirstatus mydirstatusrec dirstatus setdirstatus mydirstatus dirstatus setdirstatusrec mydirstatusrec dirstatus olddirstatusrec mydirstatusrec shellnotifyupdatefile hfind invalid_handle_value findclose hfind dirstatus dirstatus mydirstatus dirstatusrec dirstatusrec mydirstatusrec cvs status file status cvs status get combined overlay status file status s1 file status s2 tdebug enter cvs status get combined overlay status tdebug trace status s1 s2 int p1 p2 file status res p1 get file status priority s1 p2 get file status priority s2 if p1 p2 res s1 else res s2 tdebug trace new status res return res cvsstatus filestatus cvsstatus getcombinedoverlaystatus filestatus filestatus tdebug_enter cvsstatus getcombinedoverlaystatus tdebug_trace filestatus getfilestatuspriority getfilestatuspriority tdebug_trace const std string server tdebug enter cvs status recursive find root tdebug trace scan directory scan directory server server if is directory scan directory c str should not happen tdebug trace oops nondirectory return std string thisroot cvs root for path scan directory std string thisserver cvs root thisroot get server tdebug trace thisserver thisserver if thisserver server return scan directory scan directory ensure trailing delimiter scan directory entnode map entries bool result entries open entries scan directory c str if result return for entnode map const iterator it entries begin it entries end it std string filename scan directory it first if is directory filename c str std string result recursive find root filename server if result empty return result return tdebug_enter cvsstatus recursivefindroot tdebug_trace scandirectory scandirectory isdirectory scandirectory c_str tdebug_trace cvsrootforpath scandirectory cvsroot getserver tdebug_trace scandirectory scandirectory ensuretrailingdelimiter scandirectory entnodemap entries_open scandirectory c_str entnodemap const_iterator scandirectory isdirectory c_str recursivefindroot void cvs status invalidate cache cs helper cs our entnode dircs true our entnode dir cache clear cvsstatus invalidatecache cshelper ourentnodedircs ourentnodedircache bool cvs status incvs has subdirs const std string filename tdebug enter cvs status incvs has subdirs cs helper cs if is outer directory filename return false entnode data data get entnode data filename cs if data return false return data get type ent subdir cvsstatus incvshassubdirs tdebug_enter cvsstatus incvshassubdirs cshelper isouterdirectory entnodedata getentnodedata gettype ent_subdir std string cvs status cvs root for path std string path tdebug enter cvs status cvs root for path tdebug trace path path we must be a directory with a cvs dir path get directory part path path ensure trailing delimiter path if cvs directory here path tdebug trace no cvs directory found in path return std string root std string root file path cvs root std ifstream in root file c str std ios in if in good tdebug trace error opening root file return std getline in root return root cvsstatus cvsrootforpath tdebug_enter cvsstatus cvsrootforpath tdebug_trace getdirectorypart ensuretrailingdelimiter cvsdirectoryhere tdebug_trace rootfile rootfile c_str tdebug_trace rootfile std string cvs status cvs repository for path std string path tdebug enter cvs status cvs repository for path tdebug trace path path we must be a directory with a cvs dir path get directory part path path ensure trailing delimiter path if cvs directory here path return std string root file path cvs repository std ifstream in root file c str std ios in if in good return std string repository std getline in repository apparently the path in cvs repository may be either absolute or relative so if it is absolute we hack it to be relative tdebug trace repository is repository if repository 0 repository length 2 repository 1 cvs root cvsroot cvs root for path path std string root cvsroot get directory tdebug trace root is root unsigned int i 0 find out how many leading chars match while i root length i repository length if root i repository i root i repository i root i repository i i continue else break also kill final slash if repository i repository i i repository repository substr i return repository cvsstatus cvsrepositoryforpath tdebug_enter cvsstatus cvsrepositoryforpath tdebug_trace getdirectorypart ensuretrailingdelimiter cvsdirectoryhere rootfile rootfile c_str tdebug_trace cvsroot cvsrootforpath getdirectory tdebug_trace std string cvs status get clientcvs version string bool silent on error tdebug enter cvs status get clientcvs version cvs action glue 0 cvs action pipe stdout cvs action hide progress silent on error cvs action silent on error 0 glue set close ifok true make args args args add option version if glue command get temporary path args directory doesn t matter return unknown std string out glue get std out ouput can be concurrent versions system cvs x y z blah blah concurrent versions system cvsnt x y z blah blah server xxx tdebug trace output from cvs version out std string size type pos out find concurrent if pos std string npos find end of line std string size type endpos out find n pos return trim out substr pos endpos pos tdebug trace get clientcvs version failed to retrieve cvs version return cvsstatus getclientcvsversionstring silentonerror tdebug_enter cvsstatus getclientcvsversion cvsaction cvsaction pipe_stdout cvsaction hide_progress silentonerror cvsaction silent_on_error setcloseifok makeargs add_option gettemporarypath getstdout tdebug_trace size_type size_type tdebug_trace getclientcvsversion cvs action defglue tdebug enter cvs status get servercvs version tortoise registry cache trc cache server versions cache size server version bool b exists false std string s cache key get server version cache key cvsroot std string s data trc read string s cache key data b exists cvs version info cvs version info int i now get time stamp if b exists verify timestamp std string size type p s data find if p std string npos std string s time stamp s data substr 0 p int i time stamp atoi s time stamp c str if i now i time stamp cache expiration server version cvs version info parse version string s data substr p 1 if cvs version info is valid cvs version info get servercvs version uncached cvsroot defglue if cvs version info is valid char buf 200 sprintf buf d i now s data buf s data cvs version info as string trc write string s cache key data s data return cvs version info cvsaction tdebug_enter cvsstatus getservercvsversion tortoiseregistrycache serverversions cache_size_server_version bexists scachekey getserverversioncachekey sdata readstring scachekey bexists cvsversioninfo cvsversioninfo inow gettimestamp bexists size_type sdata stimestamp sdata itimestamp stimestamp c_str inow itimestamp cache_expiration_server_version cvsversioninfo parseversionstring sdata cvsversioninfo isvalid cvsversioninfo getservercvsversionuncached cvsversioninfo isvalid inow sdata sdata cvsversioninfo asstring writestring scachekey sdata cvsversioninfo bool cvs status has revision number const std string filename cs helper cs entnode data data get entnode data filename cs return has revision number data cvsstatus hasrevisionnumber cshelper entnodedata getentnodedata hasrevisionnumber bool cvs status has revision number entnode data data const char p data data entnode file kvn 0 return p strlen p cvsstatus hasrevisionnumber entnodedata entnodefile bool cvs status has timestamp const std string filename cs helper cs entnode data data get entnode data filename cs return has timestamp data cvsstatus hastimestamp cshelper entnodedata getentnodedata hastimestamp bool cvs status has timestamp entnode data data const char p 0 if data p data entnode file k conflict if p 0 p data entnode file kts return p strlen p cvsstatus hastimestamp entnodedata entnodefile kconflict entnodefile bool cvs status has sticky tag const std string filename if is outer directory filename std string tag file ensure trailing delimiter filename cvs tag std string tag char cmd tag open tag tag file c str cmd return cmd t cmd n else cs helper cs entnode data data get entnode data filename cs return has sticky tag data cvsstatus hasstickytag isouterdirectory tagfile ensuretrailingdelimiter tag_open tagfile c_str cshelper entnodedata getentnodedata hasstickytag bool cvs status has sticky tag entnode data data const char p data data entnode file k tag only 0 return p strlen p cvsstatus hasstickytag entnodedata entnodefile ktagonly bool cvs status has sticky date const std string filename if is outer directory filename std string tag file ensure trailing delimiter filename cvs tag std string tag char cmd tag open tag tag file c str cmd return cmd d else cs helper cs entnode data data get entnode data filename cs return has sticky date data cvsstatus hasstickydate isouterdirectory tagfile ensuretrailingdelimiter tag_open tagfile c_str cshelper entnodedata getentnodedata hasstickydate bool cvs status has sticky date entnode data data const char p data data entnode file k date only 0 return p strlen p cvsstatus hasstickydate entnodedata entnodefile kdateonly bool cvs status has options const std string filename cs helper cs entnode data data get entnode data filename cs return has options data cvsstatus hasoptions cshelper entnodedata getentnodedata hasoptions bool cvs status has options entnode data data const char p data data entnode file k option 0 return p strlen p cvsstatus hasoptions entnodedata entnodefile koption std string cvs status get revision number const std string filename cs helper cs entnode data data get entnode data filename cs return get revision number data cvsstatus getrevisionnumber cshelper entnodedata getentnodedata getrevisionnumber std string cvs status get revision number entnode data data return data entnode file kvn cvsstatus getrevisionnumber entnodedata entnodefile std string cvs status get timestamp const std string filename cs helper cs entnode data data get entnode data filename cs return get timestamp data cvsstatus gettimestamp cshelper entnodedata getentnodedata gettimestamp std string cvs status get timestamp entnode data data const char p data entnode file k conflict if p 0 p data entnode file kts return p cvsstatus gettimestamp entnodedata entnodefile kconflict entnodefile std string cvs status get sticky tag const std string filename if is outer directory filename std string tag file ensure trailing delimiter filename cvs tag std string tag char cmd tag open tag tag file c str cmd return tag else cs helper cs entnode data data get entnode data filename cs return get sticky tag data cvsstatus getstickytag isouterdirectory tagfile ensuretrailingdelimiter tag_open tagfile c_str cshelper entnodedata getentnodedata getstickytag std string cvs status get sticky tag entnode data data return data entnode file k tag only cvsstatus getstickytag entnodedata entnodefile ktagonly std string cvs status get sticky date const std string filename if is outer directory filename std string tag file ensure trailing delimiter filename cvs tag std string tag char cmd tag open tag tag file c str cmd return tag else cs helper cs entnode data data get entnode data filename cs return get sticky date data cvsstatus getstickydate isouterdirectory tagfile ensuretrailingdelimiter tag_open tagfile c_str cshelper entnodedata getentnodedata getstickydate std string cvs status get sticky date entnode data data return data entnode file k date only cvsstatus getstickydate entnodedata entnodefile kdateonly std string cvs status get options const std string filename cs helper cs entnode data data get entnode data filename cs return get options data cvsstatus getoptions cshelper entnodedata getentnodedata getoptions std string cvs status get options entnode data data if data 0 return if data entnode file k option 0 return return data entnode file k option cvsstatus getoptions entnodedata entnodefile koption entnodefile koption file options file options file format fmt fmt unknown keyword options ko 0 file options fo 0 int index 0 char c int len options length default if options empty if string starts with k ignore this if options substr 0 2 k index 2 get format specifier if index len c options index look for file format specifier switch c case u fmt fmt unicode index break case t fmt fmtascii index break case b fmt fmt binary index break case b fmt fmt binary fo fo binary diff index break default fmt fmtascii break else fmt fmtascii if there are no more options default to kv if index len fmt fmt binary ko key normal parse other options while index len c options index switch c case k ko key names break case v ko key values break case l ko key locker break case o ko key disabled break case z fo fo compressed break case l fo fo unix lines break index if file format file format fmt if keyword options keyword options ko if file options file options fo fileoptions fileoptions fileformat fmtunknown keywordoptions fileoptions fmtunicode fmtbinary fmtbinary fobinarydiff fmtbinary keynormal keynames keyvalues keylocker keydisabled focompressed founixlines fileformat fileformat keywordoptions keywordoptions fileoptions fileoptions file options file options parse options get options filename file format keyword options file options fileoptions fileoptions parseoptions getoptions fileformat keywordoptions fileoptions file options file options parse options get options data file format keyword options file options fileoptions fileoptions parseoptions getoptions fileformat keywordoptions fileoptions file options file options std string result is it k ku kb or kb switch file format case fmt unicode result u break case fmt binary if file options fo binary diff result b else result b break case fmtascii do nothing here break default assert 0 if file format fmt binary if keyword options key normal file options 0 if keyword options key names result k if keyword options key values result v if keyword options key locker result l if keyword options key disabled result o if file options fo unix lines result l else binary doesn t allow keyword options assert keyword options 0 binary doesn t allow unix lines assert file options fo unix lines 0 if file options fo compressed result z return result fileoptions fileoptions fileformat fmtunicode fmtbinary fileoptions fobinarydiff fileformat fmtbinary keywordoptions keynormal fileoptions keywordoptions keynames keywordoptions keyvalues keywordoptions keylocker keywordoptions keydisabled fileoptions founixlines keywordoptions fileoptions founixlines fileoptions focompressed cvs status file format cvs status get file format const std string filename cs helper cs entnode data data get entnode data filename cs return get file format data cvsstatus fileformat cvsstatus getfileformat cshelper entnodedata getentnodedata getfileformat cvs status file format cvs status get file format entnode data data std string options get options data file format fmt if options length 2 fmt fmtascii else parse options options fmt 0 0 return fmt cvsstatus fileformat cvsstatus getfileformat entnodedata getoptions fileformat parseoptions cvs status keyword options cvs status get keyword options const std string filename cs helper cs entnode data data get entnode data filename cs return get keyword options data cvsstatus keywordoptions cvsstatus getkeywordoptions cshelper entnodedata getentnodedata getkeywordoptions cvs status keyword options cvs status get keyword options entnode data data std string s options get options data keyword options ko 0 if s options length 2 ko key names key values else parse options get options data 0 ko 0 return ko cvsstatus keywordoptions cvsstatus getkeywordoptions entnodedata soptions getoptions keywordoptions soptions keynames keyvalues parseoptions getoptions cvs status file options cvs status get file options const std string filename cs helper cs entnode data data get entnode data filename cs return get file options data cvsstatus fileoptions cvsstatus getfileoptions cshelper entnodedata getentnodedata getfileoptions cvs status file options cvs status get file options entnode data data std string s options get options data file options so 0 if s options length 2 so 0 else parse options get options data 0 0 so return so cvsstatus fileoptions cvsstatus getfileoptions entnodedata soptions getoptions fileoptions soptions parseoptions getoptions std string cvs status keyword options string keyword options keyword options std string result switch keyword options case key names key values result normal break case key names result only keyword names break case key values result only keyword values break case key names key values key locker result include locker break case key disabled result disabled break case 0 result none break default result custom break add flags if keyword options 0 result if keyword options key names result k if keyword options key values result v if keyword options key locker result l if keyword options key disabled result o result return result cvsstatus keywordoptionsstring keywordoptions keywordoptions keywordoptions keynames keyvalues _ keynames _ keyvalues _ keynames keyvalues keylocker _ keydisabled _ _ _ keywordoptions keywordoptions keynames keywordoptions keyvalues keywordoptions keylocker keywordoptions keydisabled std string cvs status file format string file format file format std string result switch file format case fmt unknown result unknown break case fmtascii result text ascii break case fmt unicode result text unicode break case fmt binary result binary break return result cvsstatus fileformatstring fileformat fileformat fileformat fmtunknown _ _ fmtunicode _ fmtbinary _ std string cvs status file option string file option file option assert file option 0 std string result switch file option case fo binary diff result binary diff break case fo compressed result compressed break case fo unix lines result unix line endings break default assert 0 return result cvsstatus fileoptionstring fileoption fileoption fileoption fileoption fobinarydiff _ focompressed _ founixlines _ std string cvs status file options string file options file options std string result file option options fo binary diff fo compressed fo unix lines int i for i 0 i sizeof options sizeof options i if file options options i if result empty result result file option string options i return result cvsstatus fileoptionsstring fileoptions fileoptions fileoption fobinarydiff focompressed founixlines fileoptions fileoptionstring std string cvs status file status string file status file status std string result switch file status case status nowherenear cvs result not in cvs break case status incvs ro result unmodified r o break case status incvs rw result unmodified break case status changed result modified break case status added result added break case status conflict result needs merge break case status notincvs result not in cvs break case status outerdirectory result module break case status ignored result ignored break case status removed result removed break case status missing result missing break return result c str cvsstatus filestatusstring filestatus filestatus filestatus status_nowherenear_cvs _ status_incvs_ro _ status_incvs_rw _ status_changed _ status_added _ status_conflict _ status_notincvs _ status_outerdirectory _ status_ignored _ status_removed _ status_missing _ c_str entnode data cvs status get entnode data const std string filename cs helper cs node tdebug enter cvs status get entnode data tdebug trace looking for filename std string directory get directory above filename get filename from cache cs helper cs entnode dir data dir data get entnode dir data directory cs if dir data return 0 return get entnode data filename dir data cs node entnodedata cvsstatus getentnodedata cshelper csnode tdebug_enter cvsstatus getentnodedata tdebug_trace getdirectoryabove cshelper entnodedirdata dirdata getentnodedirdata dirdata getentnodedata dirdata csnode cs helper cs node tdebug enter cvs status get entnode data std string justfilename extract last part filename tdebug trace is justfilename in the cache check if it is in the cache entnode cache data p data 0 cs node attach dir data entnode cachecs cs node enter p data dir data entnode cache find justfilename if p data tdebug trace found justfilename check if cache value is not too old if get tick count p data time stamp entnode data cache expiration tdebug trace and it s not outdated return p data data fetch new value if p data tdebug trace insert justfilename into cache p data dir data entnode cache insert justfilename p data data get entnode data uncached filename dir data p data time stamp get tick count return p data data cshelper csnode tdebug_enter cvsstatus getentnodedata extractlastpart tdebug_trace entnodecachedata pdata csnode dirdata entnodecachecs csnode pdata dirdata entnodecache pdata tdebug_trace gettickcount pdata timestamp entnode_data_cache_expiration tdebug_trace pdata pdata tdebug_trace pdata dirdata entnodecache pdata getentnodedatauncached dirdata pdata timestamp gettickcount pdata std string cvs status read template file const std string path std string template file path template file get directory part template file template file ensure trailing delimiter template file if cvs directory here template file return template file append cvs template std ifstream in template file c str std ios in if in good return std stringstream res res in rdbuf in close return res str cvsstatus readtemplatefile template_file template_file getdirectorypart template_file template_file ensuretrailingdelimiter template_file cvsdirectoryhere template_file template_file template_file c_str bool cvs status reset file timestamp const std string filename bool b result false std string asc timestamp systemtime st filetime ft bool b is read only false handle h file invalid handle value do we have a timestamp if has timestamp filename goto cleanup convert timestamp to windows format asc timestamp get timestamp filename if asctime to systemtime asc timestamp c str st goto cleanup if system time to file time st ft goto cleanup remove read only flag b is read only is read only filename c str if b is read only set file read only filename c str false get file handle h file create file filename c str generic write file share read null open existing file attribute normal null if h file invalid handle value goto cleanup set file time if set file time h file null null ft goto cleanup b result true cleanup if h file invalid handle value close handle h file if b is read only set file read only filename c str true return b result cvsstatus resetfiletimestamp bresult asctimestamp bisreadonly hfile invalid_handle_value hastimestamp asctimestamp gettimestamp asctime_to_systemtime asctimestamp c_str systemtimetofiletime bisreadonly isreadonly c_str bisreadonly setfilereadonly c_str hfile createfile c_str generic_write file_share_read open_existing file_attribute_normal hfile invalid_handle_value setfiletime hfile bresult hfile invalid_handle_value closehandle hfile bisreadonly setfilereadonly c_str bresult bool cvs status is disabled path const std string path bool is directory tdebug enter cvs status is disabled path bool res false if tortoise registry read boolean allow network drives false path is network path path c str tdebug trace network drive path not allowed res true else if tortoise registry read boolean allow removable drives false is removable drive path path c str tdebug trace removable drive path not allowed res true else if is directory is system file path c str tdebug trace system files not allowed res true else check positive negative list std vector std string negativelist tortoise registry read vector preferences excluded directories dir negativelist bool b match false if negativelist empty if is directory b match directory matches dir list path negativelist else b match filename matches dir list path negativelist if b match tdebug trace neg match res true else std vector std string positivelist tortoise registry read vector preferences included directories dir positivelist if positivelist empty if is directory b match directory matches dir list path positivelist else b match filename matches dir list path positivelist if b match tdebug trace no pos match res true return res cvsstatus isdisabledpath isdirectory tdebug_enter cvsstatus isdisabledpath tortoiseregistry readboolean pathisnetworkpath c_str tdebug_trace tortoiseregistry readboolean isremovabledrivepath c_str tdebug_trace isdirectory issystemfile c_str tdebug_trace tortoiseregistry readvector bmatch isdirectory bmatch directorymatchesdirlist bmatch filenamematchesdirlist bmatch tdebug_trace tortoiseregistry readvector isdirectory bmatch directorymatchesdirlist bmatch filenamematchesdirlist bmatch tdebug_trace bool cvs status is outer directory const std string path tdebug enter cvs status is outer directory return is directory path c str cvs directory here path cvs directory above path cvsstatus isouterdirectory tdebug_enter cvsstatus isouterdirectory isdirectory c_str cvsdirectoryhere cvsdirectoryabove cvs status file format cvs status guess file format const std string filename if is directory filename c str return fmt unknown file format result fmt unknown if is user defined type filename result if result fmt unknown return result first check for binary extension if is binary extension filename return fmt binary check if this ought to be text regardless of contents bool is text is text extension filename read a chunk of the file std auto ptr unsigned char buf new unsigned char max test size unsigned char p buf get file samp fopen filename c str rb if samp return fmt unknown int buf size fread p sizeof char max test size samp fclose samp if buf size 0 file has zero length if the extension indicates text assume ascii return is text fmtascii fmt unknown file format format fmt binary if looks ascii p buf size format fmtascii else if looks utf8 p buf size format fmtascii else if looks unicode p buf size format fmt unicode else if looks latin1 p buf size looks extended p buf size format fmtascii else if is text format fmtascii hmm return format cvsstatus fileformat cvsstatus guessfileformat isdirectory c_str fmtunknown fileformat fmtunknown isuserdefinedtype fmtunknown isbinaryextension fmtbinary is_text istextextension auto_ptr max_test_size c_str fmtunknown bufsize max_test_size bufsize is_text fmtunknown fileformat fmtbinary looks_ascii bufsize looks_utf8 bufsize looks_unicode bufsize fmtunicode looks_latin1 bufsize looks_extended bufsize is_text bool cvs status is binary const std string file return get file format file fmt binary cvsstatus isbinary getfileformat fmtbinary bool cvs status is dir incvs const std string dir file status status get file status dir return status status incvs ro status status incvs rw status status outerdirectory cvsstatus isdirincvs filestatus getfilestatus status_incvs_ro status_incvs_rw status_outerdirectory cs helper cs dir tdebug enter cvs status get entnode dir data if cvs directory here directory return 0 std string justdirname extract last part directory if stricmp justdirname c str cvs 0 return 0 tdebug trace looking for directory check if it is in the cache entnode dir data p data 0 bool b updated false dword tmp time stamp file change params tmp fcp cs dir attach our entnode dircs cs dir enter p data our entnode dir cache find directory if p data tdebug trace found directory check if cache value is not too old if get tick count p data time stamp entnode dir cache expiration tdebug trace and it s not outdated return p data fetch new data if p data p data our entnode dir cache insert directory b updated true cs helper cs1 p data entnode cachecs true new ignored list tmp time stamp p data time stamp def ign list tmp fcp p data fcp cvs ignore build ignored list p data ignore list directory p data time stamp def ign list p data fcp cvs ignore b updated tmp fcp p data fcp cvs ignore tmp time stamp p data time stamp def ign list tmp fcp p data fcp entries if b updated p data fcp entries set null open entries entries open p data entries directory c str p data fcp entries b updated tmp fcp p data fcp entries clear data map if b updated p data entnode cache clear time stamp p data time stamp get tick count return p data cshelper csdir tdebug_enter cvsstatus getentnodedirdata cvsdirectoryhere extractlastpart c_str tdebug_trace entnodedirdata pdata bupdated tmptimestamp filechangeparams tmpfcp csdir ourentnodedircs csdir pdata ourentnodedircache pdata tdebug_trace gettickcount pdata timestamp entnode_dir_cache_expiration tdebug_trace pdata pdata pdata ourentnodedircache bupdated cshelper pdata entnodecachecs tmptimestamp pdata timestampdefignlist tmpfcp pdata fcpcvsignore buildignoredlist pdata ignorelist pdata timestampdefignlist pdata fcpcvsignore bupdated tmpfcp pdata fcpcvsignore tmptimestamp pdata timestampdefignlist tmpfcp pdata fcpentries bupdated pdata fcpentries setnull entries_open pdata c_str pdata fcpentries bupdated tmpfcp pdata fcpentries bupdated pdata entnodecache pdata timestamp gettickcount pdata entnode dir data dir data tdebug enter cvs status get entnode data uncached std string justfilename extract last part filename std string directory get directory above filename if stricmp justfilename c str cvs 0 return 0 struct stat sb memset sb 0 sizeof sb int stat return code stat filename c str sb bool b is dir sb st mode s ifdir 0 bool b is read only sb st mode s iwrite s iwrite 3 s iwrite 6 0 entnode data data entries setvisited directory c str dir data entries justfilename c str sb b is dir b is read only stat return code 0 dir data ignore list return data entnodedirdata dirdata tdebug_enter cvsstatus getentnodedatauncached extractlastpart getdirectoryabove c_str statreturncode c_str bisdir st_mode _s_ifdir bisreadonly st_mode _s_iwrite _s_iwrite _s_iwrite entnodedata entries_setvisited c_str dirdata c_str bisdir bisreadonly statreturncode dirdata ignorelist cvs action defglue tdebug enter cvs status get servercvs version uncached cvs root root cvs version info cvs version info cvs version info set unknown root setcvsroot cvsroot cvs action glue defglue cvs action close t close setting cvs action close if no errors cvs root cvs root bool hide stdout false int old errors int old uses if defglue glue new cvs action 0 else close setting glue get close hide stdout glue get hide stdout cvs root glue getcvs root old errors glue my errors old uses glue my uses glue set close ifok true glue set hide stdout if root valid glue setcvs root root make args args args add option version glue command get temporary path args directory doesn t matter std string out glue get std out tdebug trace protocol root get protocol if root get protocol local output contains only client version cvs version info parse version string out else ouput contains client xxx server xxx tdebug trace output from cvs version out std string size type pos out find server if pos std string npos cvs version info parse version string out substr pos 8 if cvs version info is valid cvs version info set unknown else tdebug trace get servercvs version uncached failed to retrieve server version if defglue delete glue else glue set close close setting glue set hide stdout hide stdout glue setcvs root cvs root glue my errors old errors glue my uses old uses return cvs version info cvsaction tdebug_enter cvsstatus getservercvsversionuncached cvsroot cvsversioninfo cvsversioninfo cvsversioninfo setunknown cvsaction cvsaction close_t closesetting cvsaction closeifnoerrors cvsroot cvsroot hidestdout olderrors olduses cvsaction closesetting getclose hidestdout gethidestdout cvsroot getcvsroot olderrors myerrors olduses myuses setcloseifok sethidestdout setcvsroot makeargs add_option gettemporarypath getstdout tdebug_trace getprotocol getprotocol cvsversioninfo parseversionstring tdebug_trace size_type cvsversioninfo parseversionstring cvsversioninfo isvalid cvsversioninfo setunknown tdebug_trace getservercvsversionuncached setclose closesetting sethidestdout hidestdout setcvsroot cvsroot myerrors olderrors myuses olduses cvsversioninfo file status status int levels tdebug enter cvs status get file status recursive uncached if status 0 status get file status filename int overlays tortoise registry read integer recursive folder overlays 1 tdebug trace overlay status overlays if overlays 0 tdebug trace don t show folder contents in overlays status status return status if status status outerdirectory status status incvs ro status status incvs rw status status added is directory filename c str bool autoload tortoise registry read boolean autoload folder overlays 0 if autoload if overlays 1 refresh given number of levels tdebug trace autoload dir status get directory status filename status 0 0 false else if overlays 2 tdebug trace autoload recursive status get directory status filename 0 status levels false else tortoise directory status dir status filename dir status set dir status status dir status set dir status rec status if overlays 1 refresh given number of levels tdebug trace load dir status if levels 0 get directory status filename 0 0 0 dir status load status dir status get dir status else if overlays 2 tdebug trace load recursive status if levels 0 get directory status filename 0 0 levels dir status load status dir status get dir status rec tdebug trace status status return status filestatus tdebug_enter cvsstatus getfilestatusrecursiveuncached getfilestatus tortoiseregistry readinteger tdebug_trace tdebug_trace status_outerdirectory status_incvs_ro status_incvs_rw status_added isdirectory c_str tortoiseregistry readboolean tdebug_trace getdirectorystatus tdebug_trace getdirectorystatus tortoisedirectorystatus dirstatus dirstatus setdirstatus dirstatus setdirstatusrec tdebug_trace getdirectorystatus dirstatus dirstatus getdirstatus tdebug_trace getdirectorystatus dirstatus dirstatus getdirstatusrec tdebug_trace void cvs status read user file types tdebug enter cvs status read user file types cs helper cs helper our user file typescs true if our user file types read our user file types read true open config file std string home dir if get home directory home dir return std string config file ensure trailing delimiter home dir tortoisecvs filetypes std ifstream types config file c str if types tdebug trace could not open config file return std string line type user file type uft const size t bufsize 500 char buf bufsize bool b valid read lines types getline buf sizeof buf line buf while true tdebug trace read line line uft wildcard cut first token line if uft wildcard empty type cut first token line if type empty b valid false make lower case type uft fileformat fmt unknown check for the file type if type binary tdebug trace uft wildcard is binary uft fileformat fmt binary b valid true else if type text tdebug trace uft wildcard is text uft fileformat fmtascii b valid true else if type unicode tdebug trace uft wildcard is unicode uft fileformat fmt unicode b valid true else if type auto tdebug trace uft wildcard is auto detect uft fileformat fmt unknown b valid true else if type dll uft fileformat fmt unknown uft dllname cut first token line uft functionname cut first token line tdebug trace uft wildcard is detected by uft functionname in uft dllname b valid true if b valid make lower case uft wildcard our user file types push back uft if types eof return types getline buf sizeof buf line buf cvsstatus readuserfiletypes tdebug_enter cvsstatus readuserfiletypes cshelper cshelper ouruserfiletypescs ouruserfiletypesread ouruserfiletypesread homedir gethomedirectory homedir configfile ensuretrailingdelimiter homedir configfile c_str tdebug_trace configfile userfiletype size_t bvalid tdebug_trace cutfirsttoken cutfirsttoken bvalid makelowercase fmtunknown tdebug_trace fmtbinary bvalid tdebug_trace bvalid tdebug_trace fmtunicode bvalid tdebug_trace fmtunknown bvalid fmtunknown cutfirsttoken cutfirsttoken tdebug_trace bvalid bvalid makelowercase ouruserfiletypes push_back bool cvs status is user defined type const std string filename cvs status file format my format tdebug enter cvs status is user defined type tdebug trace check filename rread the config file read user file types std string lfilename filename on windows filenames are case insensitive make lower case lfilename cs helper sync helper our user file typescs true find userdefined file type user file types vector const iterator p our user file types begin while p our user file types end see if we match the filename if wc match p wildcard c str lfilename c str 1 tdebug trace match if p fileformat fmt unknown tdebug trace format file format string p fileformat my format p fileformat else if p dllname empty tdebug trace call p functionname in p dllname hmodule h dll load library p dllname c str if h dll 0 tdebug trace dll not found return false user type proc proc proc user type proc get proc address h dll p functionname c str if proc 0 tdebug trace function not found free library h dll return false int i proc filename c str tdebug trace function returned i switch i case 0 my format fmt unknown break case 1 my format fmtascii break case 2 my format fmt unicode break case 3 my format fmt binary break default my format fmt unknown break free library h dll else tdebug trace format file format string p fileformat my format p fileformat return true p return false cvsstatus isuserdefinedtype cvsstatus fileformat myformat tdebug_enter cvsstatus isuserdefinedtype tdebug_trace readuserfiletypes makelowercase cshelper synchelper ouruserfiletypescs userfiletypesvector const_iterator ouruserfiletypes ouruserfiletypes wc_match c_str c_str tdebug_trace fmtunknown tdebug_trace fileformatstring myformat tdebug_trace hdll loadlibrary c_str hdll tdebug_trace usertypeproc usertypeproc getprocaddress hdll c_str tdebug_trace freelibrary hdll c_str tdebug_trace myformat fmtunknown myformat myformat fmtunicode myformat fmtbinary myformat fmtunknown freelibrary hdll tdebug_trace fileformatstring myformat bool cvs status recursive has changed files std string scan directory if is directory scan directory c str return false scan directory ensure trailing delimiter scan directory entnode map entries bool result entries open entries scan directory c str if result return false for entnode map const iterator it entries begin it entries end it std string filename scan directory it first if is directory filename c str if recursive has changed files filename return true else std string justfilename extract last part filename std string directory get directory above filename struct stat sb memset sb 0 sizeof sb int stat return code stat filename c str sb bool not there stat return code 0 entnode data data entries setvisited directory c str entries justfilename c str sb is directory filename c str 0 0 if data is unmodified if data is added return true else if not there return true if data is removed return true return false cvsstatus recursivehaschangedfiles scandirectory isdirectory scandirectory c_str scandirectory ensuretrailingdelimiter scandirectory entnodemap entries_open scandirectory c_str entnodemap const_iterator scandirectory isdirectory c_str recursivehaschangedfiles extractlastpart getdirectoryabove statreturncode c_str notthere statreturncode entnodedata entries_setvisited c_str c_str isdirectory c_str isunmodified isadded notthere isremoved int cvs status get file status priority file status status tdebug enter cvs status get file status priority int res 0 switch status case status nowherenear cvs res 0 break case status outerdirectory res 10 break case status ignored res 20 break case status incvs ro res 30 break case status incvs rw res 40 break case status removed res 50 break case status changed res 60 break case status missing res 70 break disable this as most users don t seem to like it case status notincvs res 0 break case status added res 80 break case status conflict res 90 break default res 0 break tdebug trace priority res return res cvsstatus getfilestatuspriority filestatus tdebug_enter cvsstatus getfilestatuspriority status_nowherenear_cvs status_outerdirectory status_ignored status_incvs_ro status_incvs_rw status_removed status_changed status_missing status_notincvs status_added status_conflict tdebug_trace inline up str const char newstr str 0l this newstr upstr inline up str const unsigned char newstr str 0l this newstr upstr inline up str const up str newstr str 0l this newstr upstr upstr const char up str operator const char newstr if newstr 0l newstr size t l strlen newstr if l k max char l k max char char newvalue char malloc l 2 sizeof char if newvalue 0l return null uthrow enomem strncpy newvalue 1 newstr l newvalue 0 l newvalue l 1 0 flush str newvalue return this upstr size_t kmaxchar kmaxchar const unsigned char up str operator const unsigned char newstr if newstr 0l newstr unsigned char int l newstr 0 char newvalue char malloc l 2 sizeof char if newvalue 0l return null uthrow enomem memcpy newvalue 1 char newstr 1 l sizeof char newvalue 0 l newvalue l 1 0 flush str newvalue return this upstr const up str up str operator const up str newstr this const char newstr return this upstr upstr upstr const up str up str set const char buf unsigned int len flush if len 0 return this if len k max char len k max char str char malloc len 2 sizeof char if str 0l u app console impossible to allocate d bytes n len 2 sizeof char return this memcpy str 1 buf len sizeof char str 0 len str len 1 0 return this upstr upstr kmaxchar kmaxchar uappconsole up str up str operator const char add to str if add to str 0l return this if str 0l this add to str return this size t len strlen add to str unsigned curlen length if len length k max char len k max char length if len 0 return this str char realloc str len curlen 2 sizeof char memcpy str curlen 1 add to str len sizeof char str 0 len curlen str len curlen 1 0 return this upstr upstr addtostr addtostr addtostr size_t addtostr kmaxchar kmaxchar addtostr up str up str operator char add to str char astr 2 0 0 astr 0 add to str return this astr upstr upstr addtostr addtostr up str up str operator int add to str char astr 50 sprintf astr d add to str return this astr upstr upstr addtostr addtostr const up str up str replace char which char bywhich if str 0l return this char buf str 1 while buf if buf which buf bywhich else buf return this upstr upstr void up str flush void if str 0l return free str str 0l upstr inline u str const char newstr str 0l this newstr ustr inline u str const unsigned char newstr str 0l set const char newstr 1 newstr 0 ustr inline u str const u str newstr str 0l this newstr ustr ustr const char u str operator const char newstr if newstr 0l newstr int l strlen newstr char newvalue char malloc l 1 sizeof char if newvalue 0l return null uthrow enomem strcpy newvalue newstr flush str newvalue return this ustr const char u str operator const unsigned char newstr if newstr 0l newstr unsigned char int l newstr 0 char newvalue char malloc l 1 sizeof char if newvalue 0l return null uthrow enomem memcpy newvalue newstr 1 l sizeof char newvalue l 0 flush str newvalue return this ustr const u str u str operator const u str newstr this const char newstr return this ustr ustr ustr const u str u str set const char buf unsigned int len flush if len 0 return this str char malloc len 1 sizeof char if str 0l u app console impossible to allocate d bytes n len 1 sizeof char return this memcpy str buf len sizeof char str len 0 return this ustr ustr uappconsole u str u str operator const char add to str if add to str 0l return this if str 0l this add to str return this unsigned int len strlen add to str if len 0 return this unsigned int curlen length char newstr char malloc len curlen 1 sizeof char if newstr 0l return this uthrow enomem memcpy newstr str curlen sizeof char memcpy newstr curlen add to str len sizeof char newstr len curlen 0 if str 0l free str str newstr return this ustr ustr addtostr addtostr addtostr addtostr addtostr u str u str operator char add to str char astr 2 0 0 astr 0 add to str return this astr ustr ustr addtostr addtostr u str u str operator int add to str char astr 50 sprintf astr d add to str return this astr ustr ustr addtostr addtostr const u str u str replace char which char bywhich if str 0l return this char buf str while buf if buf which buf bywhich else buf return this ustr ustr void u str flush void if str 0l return free str str 0l ustr my initialized false myinitialized inline void setcvs root const std string cvs root if cvs root mycvs root mycvs root cvs root my initialized false setcvsroot cvsroot cvsroot mycvsroot mycvsroot cvsroot myinitialized inline std string getcvs root const return mycvs root getcvsroot mycvsroot bool cvs server features initialize cvs action glue bool result true if my initialized result false my version info cvs status get servercvs version mycvs root glue if my version info is valid my initialized true result true return result cvsserverfeatures cvsaction myinitialized myversioninfo cvsstatus getservercvsversion mycvsroot myversioninfo isvalid myinitialized bool cvs server features supports file options const assert my initialized return my version info iscvsnt my version info cvs status cvs version info 2 0 18 cvsserverfeatures supportsfileoptions myinitialized myversioninfo myversioninfo cvsstatus cvsversioninfo bool cvs server features supports unicode const assert my initialized return my version info iscvsnt my version info cvs status cvs version info 2 0 11 cvsserverfeatures supportsunicode myinitialized myversioninfo myversioninfo cvsstatus cvsversioninfo bool cvs server features supports ls const assert my initialized all versions of cvsnt and cvshome org versions starting from 1 12 8 return my version info iscvsnt my version info cvs status cvs version info 1 12 8 cvsserverfeatures supportsls myinitialized myversioninfo myversioninfo cvsstatus cvsversioninfo bool cvs server features supports three way diffs const assert my initialized return my version info iscvsnt my version info cvs status cvs version info 2 0 18 cvsserverfeatures supportsthreewaydiffs myinitialized myversioninfo myversioninfo cvsstatus cvsversioninfo m timestamp 0 m_timestamp