void wait status cursor set status display i status display pi status display c pistatusdisplay pi status display waitstatuscursor setstatusdisplay istatusdisplay pistatusdisplay c_pistatusdisplay pistatusdisplay m ended false va list args va start args fmt m msg formatv fmt args va end args if c pistatusdisplay m oldmsg c pistatusdisplay begin status m msg m_ended va_list va_start m_msg va_end c_pistatusdisplay m_oldmsg c_pistatusdisplay beginstatus m_msg void wait status cursor change msg lpctstr fmt va list args va start args fmt m msg formatv fmt args va end args if c pistatusdisplay c pistatusdisplay change status m msg waitstatuscursor changemsg va_list va_start m_msg va_end c_pistatusdisplay c_pistatusdisplay changestatus m_msg void wait status cursor end if m ended m ended true if c pistatusdisplay c pistatusdisplay end status m msg m oldmsg m msg t m oldmsg t waitstatuscursor m_ended m_ended c_pistatusdisplay c_pistatusdisplay endstatus m_msg m_oldmsg m_msg _t m_oldmsg _t wait status cursor wait status cursor end waitstatuscursor waitstatuscursor rescan suppress c merge doc doc m doc doc m bsuppress true m bprev doc m benablerescan doc m benablerescan false rescansuppress cmergedoc m_doc m_bsuppress m_bprev m_benablerescan m_benablerescan void clear if m bsuppress m bsuppress false m doc m benablerescan m bprev m_bsuppress m_bsuppress m_doc m_benablerescan m_bprev rescan suppress clear rescansuppress c diff text buffer c merge doc p doc bool b left m pownerdoc p doc m bisleft b left cdifftextbuffer cmergedoc pdoc bleft m_pownerdoc pdoc m_bisleft bleft bool get line int n line index c string str line int n line length c crystal text buffer get line length n line index if n line length 0 return false else if n line length 0 str line empty else tcsncpy str line get buffer n line length 1 c crystal text buffer get line chars n line index n line length str line release buffer n line length return true getline nlineindex cstring strline nlinelength ccrystaltextbuffer getlinelength nlineindex nlinelength nlinelength strline _tcsncpy strline getbuffer nlinelength ccrystaltextbuffer getlinechars nlineindex nlinelength strline releasebuffer nlinelength virtual void set modified bool b modified true c crystal text buffer set modified b modified m pownerdoc set modified flag b modified setmodified bmodified ccrystaltextbuffer setmodified bmodified m_pownerdoc setmodifiedflag bmodified void insert line lpctstr psz line int n length 1 int n position 1 c crystal text buffer insert line psz line n length n position insertline pszline nlength nposition ccrystaltextbuffer insertline pszline nlength nposition bool c merge doc c diff text buffer flag is set uint line dword flag return m alines line m dwflags flag flag cmergedoc cdifftextbuffer flagisset m_alines m_dwflags int c merge doc c diff text buffer determinecrlf style lpvoid lp buf dword dw length dword w loop size 0xffff int n crlf style crlf style dos default tchar lp buffer tchar lp buf if dw length 0xffff w loop size dw length find first linebreak for dword i 0 i w loop size i lp buffer if lp buffer t r lp buffer t n break by default or in the case of empty file use dos style if i w loop size otherwise analyse the first occurance of line feed character if lp buffer t n n crlf style crlf style unix else found r crlf is dos r n or mac r if i w loop size 1 lp buffer 1 t n n crlf style crlf style dos else n crlf style crlf style mac return n crlf style cmergedoc cdifftextbuffer determinecrlfstyle lpbuf dwlength wloopsize ncrlfstyle crlf_style_dos lpbuffer lpbuf dwlength wloopsize dwlength wloopsize lpbuffer lpbuffer _t lpbuffer _t wloopsize lpbuffer _t ncrlfstyle crlf_style_unix wloopsize lpbuffer _t ncrlfstyle crlf_style_dos ncrlfstyle crlf_style_mac ncrlfstyle void c merge doc c diff text buffer read line from buffer tchar lp line begin dword dw line len 0 if m nsourceencoding 0 iconvert lp line begin m nsourceencoding 1 m nsourceencoding 15 insert line lp line begin dw line len cmergedoc cdifftextbuffer readlinefrombuffer lplinebegin dwlinelen m_nsourceencoding lplinebegin m_nsourceencoding m_nsourceencoding insertline lplinebegin dwlinelen void c merge doc c diff text buffer set temp path c string path m strtemppath path cmergedoc cdifftextbuffer settemppath cstring m_strtemppath bool c merge doc c diff text buffer cur undo group return m aundobuf get size 0 m aundobuf 0 m dwflags undo begingroup cmergedoc cdifftextbuffer curundogroup m_aundobuf getsize m_aundobuf m_dwflags undo_begingroup void c merge doc c diff text buffer replace line int n line const c string str text if get line length n line 0 delete text null n line 0 n line get line length n line int endl endc insert text null n line 0 str text endl endc cmergedoc cdifftextbuffer replaceline nline cstring strtext getlinelength nline deletetext nline nline getlinelength nline inserttext nline strtext c string text bool b left int n crlf style crlf style automatic int lines m alines get size assert n start line 0 n start line lines assert n start char 0 n start char m alines n start line m nlength assert n end line 0 n end line lines assert n end char 0 n end char m alines n end line m nlength assert n start line n end line n start line n end line n start char n end char if n crlf style crlf style automatic n crlf style getcrlf mode assert n crlf style 0 n crlf style 2 lpctstr pszcrlf crlfs n crlf style int ncrlf length tcslen pszcrlf assert ncrlf length 0 int n buf size 0 count text length incl linefeeds for int i n start line i n end line i skip blank diff lines if m bisleft flag is set i lf left only m bisleft flag is set i lf right only n buf size m alines i m nlength n buf size ncrlf length lptstr psz buf text get buffer n buf size multiple lines if n start line n end line skip blank diff lines if m bisleft flag is set n start line lf left only m bisleft flag is set n start line lf right only copy part of first line int n count m alines n start line m nlength n start char if n count 0 copy memory psz buf m alines n start line m pcline n start char n count sizeof tchar psz buf n count copy memory psz buf pszcrlf ncrlf length sizeof tchar psz buf ncrlf length other lines for i n start line 1 i n end line i skip blank diff lines if m bisleft flag is set i lf left only m bisleft flag is set i lf right only int n count m alines i m nlength if n count 0 copy memory psz buf m alines i m pcline n count sizeof tchar psz buf n count copy memory psz buf pszcrlf ncrlf length sizeof tchar psz buf ncrlf length last line if n end char 0 skip blank diff lines if m bisleft flag is set n end line lf left only m bisleft flag is set n end line lf right only copy memory psz buf m alines n end line m pcline n end char sizeof tchar psz buf n end char else skip blank diff lines if m bisleft flag is set n start line lf left only m bisleft flag is set n start line lf right only int n count n end char n start char copy memory psz buf m alines n start line m pcline n start char n count sizeof tchar psz buf n count psz buf 0 0 text release buffer text free extra return n buf size cstring bleft ncrlfstyle crlf_style_automatic m_alines getsize nstartline nstartline nstartchar nstartchar m_alines nstartline m_nlength nendline nendline nendchar nendchar m_alines nendline m_nlength nstartline nendline nstartline nendline nstartchar nendchar ncrlfstyle crlf_style_automatic ncrlfstyle getcrlfmode ncrlfstyle ncrlfstyle ncrlfstyle ncrlflength _tcslen ncrlflength nbufsize nstartline nendline m_bisleft flagisset lf_left_only m_bisleft flagisset lf_right_only nbufsize m_alines m_nlength nbufsize ncrlflength pszbuf getbuffer nbufsize nstartline nendline m_bisleft flagisset nstartline lf_left_only m_bisleft flagisset nstartline lf_right_only ncount m_alines nstartline m_nlength nstartchar ncount copymemory pszbuf m_alines nstartline m_pcline nstartchar ncount pszbuf ncount copymemory pszbuf ncrlflength pszbuf ncrlflength nstartline nendline m_bisleft flagisset lf_left_only m_bisleft flagisset lf_right_only ncount m_alines m_nlength ncount copymemory pszbuf m_alines m_pcline ncount pszbuf ncount copymemory pszbuf ncrlflength pszbuf ncrlflength nendchar m_bisleft flagisset nendline lf_left_only m_bisleft flagisset nendline lf_right_only copymemory pszbuf m_alines nendline m_pcline nendchar pszbuf nendchar m_bisleft flagisset nstartline lf_left_only m_bisleft flagisset nstartline lf_right_only ncount nendchar nstartchar copymemory pszbuf m_alines nstartline m_pcline nstartchar ncount pszbuf ncount pszbuf releasebuffer freeextra nbufsize lpctstr psz text int n action type ce action unknown int n undo position m nundoposition c crystal text buffer add undo record b insert pt start pos pt end pos psz text n action type if m aundobuf n undo position m dwflags undo begingroup m pownerdoc undo tgt erase m pownerdoc cur undo m pownerdoc undo tgt end m pownerdoc undo tgt push back m bisleft m pownerdoc get left view m pownerdoc get right view m pownerdoc cur undo m pownerdoc undo tgt end psztext nactiontype ce_action_unknown nundoposition m_nundoposition ccrystaltextbuffer addundorecord binsert ptstartpos ptendpos psztext nactiontype m_aundobuf nundoposition m_dwflags undo_begingroup m_pownerdoc undotgt m_pownerdoc curundo m_pownerdoc undotgt m_pownerdoc undotgt push_back m_bisleft m_pownerdoc getleftview m_pownerdoc getrightview m_pownerdoc curundo m_pownerdoc undotgt int n crlf style crlf style automatic assert m binit assert m alines get size 0 mappedfiledata file data 0 c string s ext bool b success false bool n ret val fresult ok set encoding based on extension if we know one split filename psz file name null null s ext c crystal text view text definition def c crystal text view get text type s ext if def def encoding 1 m nsourceencoding def encoding init filedata struct and open file as memory mapped tcsncpy file data file name psz file name sizeof file data file name file data b writable false file data dw open flags open existing b success files openfilemapped file data if b success n ret val files bincheck file data else n ret val fresult error if n ret val fresult ok try to determine current crlf mode based on first line if n crlf style crlf style automatic n crlf style determinecrlf style file data p map base file data dw size assert n crlf style 0 n crlf style 2 setcrlf mode n crlf style m alines set size 0 4096 dword dw bytes read 0 tchar lp char tchar file data p map base tchar lp line begin lp char int eol chars 0 while dw bytes read file data dw size tchar c lp char eol found if c n c r eol chars files readeol lp char file data dw size dw bytes read mf m beolsensitive read line from buffer lp line begin lp char lp line begin lp char eol chars dw bytes read eol chars skip eol chars lp line begin lp char else lp char dw bytes read read line from buffer lp line begin lp char lp line begin assert m alines get size 0 at least one empty line must present m binit true m bmodified false m bundogroup m bundobegingroup false m nundobufsize 1024 crystaltextbuffer cpp undo buf size m nsyncposition m nundoposition 0 assert m aundobuf get size 0 this is needed syntax hilighting does not work when automatically scroll to first diff is enabled retype views psz file name update views null null update reset m ptlastchange x m ptlastchange y 1 n ret val fresult ok files closefilemapped file data 0xffffffff false return n ret val ncrlfstyle crlf_style_automatic m_binit m_alines getsize filedata cstring sext bsuccess nretval fresult_ok splitfilename pszfilename sext ccrystaltextview textdefinition ccrystaltextview gettexttype sext m_nsourceencoding _tcsncpy filedata filename pszfilename filedata filename filedata bwritable filedata dwopenflags open_existing bsuccess files_openfilemapped filedata bsuccess nretval files_bincheck filedata nretval fresult_error nretval fresult_ok ncrlfstyle crlf_style_automatic ncrlfstyle determinecrlfstyle filedata pmapbase filedata dwsize ncrlfstyle ncrlfstyle setcrlfmode ncrlfstyle m_alines setsize dwbytesread lpchar filedata pmapbase lplinebegin lpchar eolchars dwbytesread filedata dwsize lpchar eolchars files_readeol lpchar filedata dwsize dwbytesread m_beolsensitive readlinefrombuffer lplinebegin lpchar lplinebegin lpchar eolchars dwbytesread eolchars lplinebegin lpchar lpchar dwbytesread readlinefrombuffer lplinebegin lpchar lplinebegin m_alines getsize m_binit m_bmodified m_bundogroup m_bundobegingroup m_nundobufsize undo_buf_size m_nsyncposition m_nundoposition m_aundobuf getsize retypeviews pszfilename updateviews update_reset m_ptlastchange m_ptlastchange nretval fresult_ok files_closefilemapped filedata nretval bool b clear modified flag true assert n crlf style crlf style automatic n crlf style crlf style dos n crlf style crlf style unix n crlf style crlf style mac assert m binit mappedfiledata file data 0 tchar sz temp file dir max path 0 tchar sz temp file name max path 0 bool b open success false bool b save success false tchar drive max path 0 tchar dir max path 0 if n crlf style crlf style automatic n crlf style getcrlf mode hack for mac files support temp files for diff must be in unix format if b temp file n crlf style crlf style mac n crlf style crlf style unix assert n crlf style 0 n crlf style 2 lpctstr pszcrlf crlfs n crlf style int ncrlf length tcslen pszcrlf int n line count m alines get size c string text int n last length m alines n line count 1 m nlength uint n buf size get text without emptys 0 0 n line count 1 n last length text m bisleft n crlf style remove last crlf text delete n buf size ncrlf length ncrlf length n buf size ncrlf length if psz file name return false no filename cannot save if b temp file if get temp file name m strtemppath t mrg 0 sz temp file name return false nothing to do if even tempfile name fails init filedata struct and open file as memory mapped if b temp file tcsncpy file data file name psz file name sizeof file data file name else tcsncpy file data file name sz temp file name sizeof file data file name file data b writable true file data dw open flags create always file data dw size n buf size b open success files openfilemapped file data if b open success if m nsourceencoding 0 lptstr psz buf iconvert new lpctstr text psz buf 1 m nsourceencoding m nsourceencoding 15 copy memory file data p map base psz buf n buf size free psz buf else copy memory file data p map base void lpctstr text n buf size force flushing of file buffers for user files if b temp file files closefilemapped file data n buf size false else files closefilemapped file data n buf size true if b temp file write tempfile over original file if copy file sz temp file name psz file name false delete file sz temp file name if b clear modified flag set modified false m nsyncposition m nundoposition b save success true else if b clear modified flag set modified false m nsyncposition m nundoposition b save success true return b save success bclearmodifiedflag ncrlfstyle crlf_style_automatic ncrlfstyle crlf_style_dos ncrlfstyle crlf_style_unix ncrlfstyle crlf_style_mac m_binit filedata sztempfiledir _max_path sztempfilename _max_path bopensuccess bsavesuccess _max_path _max_path ncrlfstyle crlf_style_automatic ncrlfstyle getcrlfmode btempfile ncrlfstyle crlf_style_mac ncrlfstyle crlf_style_unix ncrlfstyle ncrlfstyle ncrlfstyle ncrlflength _tcslen nlinecount m_alines getsize cstring nlastlength m_alines nlinecount m_nlength nbufsize gettextwithoutemptys nlinecount nlastlength m_bisleft ncrlfstyle nbufsize ncrlflength ncrlflength nbufsize ncrlflength pszfilename btempfile gettempfilename m_strtemppath _t sztempfilename btempfile _tcsncpy filedata filename pszfilename filedata filename _tcsncpy filedata filename sztempfilename filedata filename filedata bwritable filedata dwopenflags create_always filedata dwsize nbufsize bopensuccess files_openfilemapped filedata bopensuccess m_nsourceencoding pszbuf iconvert_new pszbuf m_nsourceencoding m_nsourceencoding copymemory filedata pmapbase pszbuf nbufsize pszbuf copymemory filedata pmapbase nbufsize btempfile files_closefilemapped filedata nbufsize files_closefilemapped filedata nbufsize btempfile copyfile sztempfilename pszfilename deletefile sztempfilename bclearmodifiedflag setmodified m_nsyncposition m_nundoposition bsavesuccess bclearmodifiedflag setmodified m_nsyncposition m_nundoposition bsavesuccess bsavesuccess c merge doc c merge doc m ltbuf this true m rtbuf this false m diffs set size 64 m ndiffs 0 m ncurdiff 1 m strtempleftfile m strtemprightfile m benablerescan true m bneedidlerescan false c ole date time m lastrescan cur undo undo tgt begin m pleftview null m prightview null m pdirdoc null cmergedoc cmergedoc m_ltbuf m_rtbuf m_diffs setsize m_ndiffs m_ncurdiff m_strtempleftfile m_strtemprightfile m_benablerescan m_bneedidlerescan coledatetime m_lastrescan curundo undotgt m_pleftview m_prightview m_pdirdoc void c merge doc update header activity bool b left bool b activate c child frame pf get parent frame assert pf int n pane b left 0 1 pf set header activity n pane b activate cmergedoc updateheaderactivity bleft bactivate cchildframe getparentframe npane bleft setheaderactivity npane bactivate void c merge doc set need rescan m bneedidlerescan true cmergedoc setneedrescan m_bneedidlerescan void c merge doc rescan if needed rescan if we were asked for a rescan when convenient and if we ve not rescanned in at least a second if m bneedidlerescan m bneedidlerescan false c ole date time span elapsed c ole date time get current time m lastrescan if elapsed get total seconds 1 wait status cursor waitstatus load res string ids status rescanning flush and rescan cmergedoc rescanifneeded m_bneedidlerescan m_bneedidlerescan coledatetimespan coledatetime getcurrenttime m_lastrescan gettotalseconds waitstatuscursor loadresstring ids_status_rescanning flushandrescan int c merge doc rescan bool b forced false if b forced if m benablerescan return rescan suppressed m bneedidlerescan false m lastrescan c ole date time get current time store modified status bool lt mod m ltbuf is modified bool rt mod m rtbuf is modified remove blank lines and clear winmerge flags prepare buffer for rescan m ltbuf lf right only prepare buffer for rescan m rtbuf lf left only restore modified status m ltbuf set modified lt mod m rtbuf set modified rt mod get the desired files to temp locations so we can edit them dynamically if temp files exist if init temp files m strleftfile m strrightfile return rescan file err output to temp file m ltbuf save to file m strtempleftfile true crlf style automatic false m rtbuf save to file m strtemprightfile true crlf style automatic false perform rescan struct file data inf 2 char free0 null free1 null c string sdir0 sdir1 sname0 sname1 sext0 sext1 int val failed 0 depth 0 bool same files false struct change e p struct change script null int n result rescan ok m diffs remove all m ndiffs 0 m ncurdiff 1 split filename m strtempleftfile sdir0 sname0 0 split filename m strtemprightfile sdir1 sname1 0 zero memory inf 0 sizeof inf 0 zero memory inf 1 sizeof inf 1 both exist and neither is a directory int o binary always text flag 0 o binary open the files and record their descriptors if sdir0 is empty inf 0 name sname0 else inf 0 name free0 dir file pathname sdir0 sname0 inf 0 desc 2 if sdir1 is empty inf 1 name sname1 else inf 1 name free1 dir file pathname sdir1 sname1 inf 1 desc 2 if inf 0 desc 2 if inf 0 desc open inf 0 name o rdonly o binary 0 0 perror with name inf 0 name failed 1 if inf 1 desc 2 if same files inf 1 desc inf 0 desc else if inf 1 desc open inf 1 name o rdonly o binary 0 0 perror with name inf 1 name failed 1 compare the files if no error was found int diff flag 0 script diff 2 files inf depth diff flag throw the diff into a temp file char lp buffer max path path buffer get temp path max path lp buffer get path to temp folder c string path c string lp buffer t diff txt outfile fopen path w if outfile null print normal script script fclose outfile outfile null struct change next script int trans a0 trans b0 trans a1 trans b1 int first0 last0 first1 last1 deletes inserts op struct change thisob end while next find a set of changes that belong together thisob next end find change next disconnect them from the rest of the changes making them a hunk and remember the rest for next iteration next end link end link 0 ifdef debug debug script thisob endif print thisob hunk printfun thisob determine range of line numbers involved in each file analyze hunk thisob first0 last0 first1 last1 deletes inserts if deletes inserts if deletes inserts op op diff else if deletes op op leftonly else op op rightonly print the lines that the first file has translate range inf 0 first0 last0 trans a0 trans b0 translate range inf 1 first1 last1 trans a1 trans b1 add diff range trans a0 1 trans b0 1 trans a1 1 trans b1 1 byte op trace left d d right d d op d n trans a0 1 trans b0 1 trans a1 1 trans b1 1 op reconnect the script so it will all be freed properly end link next cleanup the script for e script e e p p e link free e if comparing whitespaces and other file has eol before eof and other not if inf 0 missing newline inf 1 missing newline mf m nignorewhitespace lasf diffrange of file which has eol must be fixed to contain last line too fix last diff range inf 1 missing newline cleanup file buffers inf close the file descriptors if inf 0 desc 0 close inf 0 desc 0 perror with name inf 0 name val 2 if inf 1 desc 0 inf 0 desc inf 1 desc close inf 1 desc 0 perror with name inf 1 name val 2 binary files or errors if diff flag 0 n result rescan binaries else if failed n result rescan file err else identical files are also updated if m ndiffs 0 n result rescan identical display the files prime text buffers m pleftview prime list with file m prightview prime list with file prime list with file will call resetview which resets tabs mf m pleft set tab size mf m ntabsize mf m pright set tab size mf m ntabsize todo int lcnt m ltbuf get line count int rcnt m rtbuf get line count if lcnt rcnt m diffs m ndiffs 1 dbegin0 lcnt m diffs m ndiffs 1 dend0 rcnt m diffs m ndiffs 1 blank0 lcnt else if rcnt lcnt m diffs m ndiffs 1 dbegin1 rcnt m diffs m ndiffs 1 dend1 lcnt m diffs m ndiffs 1 blank1 rcnt while lcnt rcnt mf m pleft add item lcnt 0 mf m pleft m plist set item data lcnt 1 lcnt while rcnt lcnt mf m pright add item rcnt 0 mf m pright m plist set item data rcnt 1 rcnt if free0 free free0 if free1 free free1 return n result cmergedoc bforced bforced m_benablerescan rescan_suppressed m_bneedidlerescan m_lastrescan coledatetime getcurrenttime ltmod m_ltbuf ismodified rtmod m_rtbuf ismodified preparebufferforrescan m_ltbuf lf_right_only preparebufferforrescan m_rtbuf lf_left_only m_ltbuf setmodified ltmod m_rtbuf setmodified rtmod tempfilesexist inittempfiles m_strleftfile m_strrightfile rescan_file_err m_ltbuf savetofile m_strtempleftfile crlf_style_automatic m_rtbuf savetofile m_strtemprightfile crlf_style_automatic file_data cstring same_files nresult rescan_ok m_diffs removeall m_ndiffs m_ncurdiff splitfilename m_strtempleftfile splitfilename m_strtemprightfile zeromemory zeromemory o_binary always_text_flag o_binary isempty dir_file_pathname isempty dir_file_pathname o_rdonly o_binary perror_with_name same_files o_rdonly o_binary perror_with_name diff_flag diff_2_files diff_flag lpbuffer max_path gettemppath max_path lpbuffer cstring cstring lpbuffer _t print_normal_script trans_a0 trans_b0 trans_a1 trans_b1 find_change debug_script analyze_hunk op_diff op_leftonly op_rightonly translate_range trans_a0 trans_b0 translate_range trans_a1 trans_b1 adddiffrange trans_a0 trans_b0 trans_a1 trans_b1 trans_a0 trans_b0 trans_a1 trans_b1 missing_newline missing_newline m_nignorewhitespace fixlastdiffrange missing_newline cleanup_file_buffers perror_with_name perror_with_name diff_flag nresult rescan_binaries nresult rescan_file_err m_ndiffs nresult rescan_identical primetextbuffers m_pleftview primelistwithfile m_prightview primelistwithfile primelistwithfile m_pleft settabsize m_ntabsize m_pright settabsize m_ntabsize m_ltbuf getlinecount m_rtbuf getlinecount m_diffs m_ndiffs m_diffs m_ndiffs m_diffs m_ndiffs m_diffs m_ndiffs m_diffs m_ndiffs m_diffs m_ndiffs m_pleft additem m_pleft m_plist setitemdata m_pright additem m_pright m_plist setitemdata nresult void c merge doc add diff range uint begin0 uint end0 uint begin1 uint end1 byte op try diffrange dr 0 dr begin0 begin0 dr end0 end0 dr begin1 begin1 dr end1 end1 dr op op dr blank0 dr blank1 1 m diffs set at grow m ndiffs dr m ndiffs catch all e tchar msg 1024 0 e get error message msg 1024 afx message box msg mb iconstop end catch all cmergedoc adddiffrange m_diffs setatgrow m_ndiffs m_ndiffs catch_all geterrormessage afxmessagebox mb_iconstop end_catch_all void c merge doc fix last diff range bool left diffrange dr 0 int count m diffs get size if count 0 dr m diffs get at count 1 if left if dr op op rightonly dr op op diff dr end0 else if dr op op leftonly dr op op diff dr end1 m diffs set at count 1 dr else we have to create the diff dr end0 m ltbuf get line count 1 dr end1 m rtbuf get line count 1 if left dr begin0 dr end0 dr begin1 dr end1 1 dr op op leftonly else dr begin0 dr end0 1 dr begin1 dr end1 dr op op rightonly assert dr begin0 dr begin1 add diff range dr begin0 dr end0 dr begin1 dr end1 dr op cmergedoc fixlastdiffrange m_diffs getsize m_diffs getat op_rightonly op_diff op_leftonly op_diff m_diffs setat m_ltbuf getlinecount m_rtbuf getlinecount op_leftonly op_rightonly adddiffrange void c merge doc show rescan error int n rescan result c string s switch n rescan result case rescan identical verify s load string ids filessame afx message box s mb iconinformation break case rescan binaries verify s load string ids bin files diff afx message box s mb iconinformation break case rescan file err verify s load string ids fileerror afx message box s mb iconstop break cmergedoc showrescanerror nrescanresult cstring nrescanresult rescan_identical loadstring ids_filessame afxmessagebox mb_iconinformation rescan_binaries loadstring ids_bin_files_diff afxmessagebox mb_iconinformation rescan_file_err loadstring ids_fileerror afxmessagebox mb_iconstop void c merge doc add undo action uint n begin uint n end uint n diff int n blanks bool b insert c merge edit view p list c undo item pitem new c undo item if pitem null pitem begin n begin pitem end n end pitem diffidx n diff pitem blank n blanks pitem b insert b insert pitem m plist p list if b insert for uint i n begin i n end i c string s pitem m plist get line text i pitem list add tail s m undolist add head pitem cmergedoc addundoaction nbegin nend ndiff nblanks binsert cmergeeditview plist cundoitem cundoitem nbegin nend ndiff nblanks binsert binsert m_plist plist binsert nbegin nend cstring m_plist getlinetext addtail m_undolist addhead bool c merge doc undo todo if m undolist is empty c undo item pitem c undo item m undolist remove head if pitem null if pitem b insert c string s position pos pitem list get head position uint i pitem begin while pos null s pitem list get next pos pitem m plist m plist set item text i 0 s i if pitem m plist mf m pleft m diffs pitem diffidx blank0 pitem blank else m diffs pitem diffidx blank1 pitem blank scroll to the diff int line max 0 m diffs pitem diffidx dbegin0 context lines mf m pleft scroll to line line mf m pright scroll to line line select the diff mf m pleft select diff pitem diffidx else assert 0 pitem m plist sub mod delete pitem return true return false cmergedoc m_undolist isempty cundoitem cundoitem m_undolist removehead binsert cstring getheadposition getnext m_plist m_plist setitemtext m_plist m_pleft m_diffs m_diffs m_diffs context_lines m_pleft scrolltoline m_pright scrolltoline m_pleft selectdiff m_plist submod void c merge doc copy all list bool b src left rescan suppress suppress rescan this note we don t care about m ndiffs count to become zero because we don t rescan so it does not change copy from bottom up is more efficient for int i m ndiffs 1 i 0 i set current diff i list copy b src left suppress rescan clear done suppress rescan flush and rescan cmergedoc copyalllist bsrcleft rescansuppress suppressrescan m_ndiffs m_ndiffs setcurrentdiff listcopy bsrcleft suppressrescan flushandrescan void c merge doc list copy bool b src left suppress rescan during this method not only do we not want to rescan a lot of times but it will wreck the line status array to rescan as we merge rescan suppress suppress rescan this make sure we re on a diff int cur diff get current diff if cur diff 1 diffrange cd m diffs cur diff c diff text buffer sbuf b src left m ltbuf m rtbuf c diff text buffer dbuf b src left m rtbuf m ltbuf bool b src was mod sbuf is modified int cd dbegin b src left cd dbegin0 cd dbegin1 int cd dend b src left cd dend0 cd dend1 int cd blank b src left cd blank0 cd blank1 todo add the undo action if the current diff contains missing lines remove them from both sides int deleted lines 0 int limit cd dend position pos get first view position c crystal text view cur view dynamic cast c crystal text view get next view pos if b src left cur view dynamic cast c crystal text view get next view pos dbuf begin undo group if cd blank 0 text was missing so delete rest of lines on both sides delete only on destination side since rescan will clear the other side c merge edit view active static cast c merge edit view static cast cmdi frame wnd afx get main wnd mdi get active get active view c point pt active get cursor pos if cd blank 0 if pt y cd blank pt y cd dend pt y cd blank active set cursor pos pt dbuf delete text null cd blank 0 cd dend 1 0 ce action delete false else if pt y cd blank pt y cd dend pt y cd blank 1 if removing first line set x to 0 calculating line length is unneccessary work pt x 0 active set cursor pos pt dbuf delete text null cd blank 1 dbuf get line length cd blank 1 cd dend dbuf get line length cd dend ce action delete false deleted lines cd dend cd blank 1 limit cd blank 1 dbuf flush undo group cur view dbuf begin undo group true c string str line copy the selected text over for int i cd dbegin i limit i clear the line flags sbuf set line flag i lf winmerge flags false false false dbuf set line flag i lf winmerge flags false false false text exists on left side so just replace sbuf get line i str line dbuf replace line i str line dbuf flush undo group cur view dbuf begin undo group true dbuf flush undo group null mf m pright replace selection str text 0 p src list invalidate lines cd dbegin cd dend p dest list invalidate lines cd dbegin cd dend remove the diff set current diff 1 no longer needed since rescan automatically does this m diffs remove at cur diff m ndiffs adjust remaining diffs if deleted lines 0 for int i cur diff i int m ndiffs i diffrange cd m diffs i cd dbegin0 deleted lines cd dbegin1 deleted lines cd dend0 deleted lines cd dend1 deleted lines cd blank0 deleted lines cd blank1 deleted lines reset the mod status of the source view because we do make some changes but none that concern the source text sbuf set modified b src was mod what does this do p dest list add mod suppress rescan clear done suppress rescan flush and rescan cmergedoc listcopy bsrcleft rescansuppress suppressrescan curdiff getcurrentdiff curdiff m_diffs curdiff cdifftextbuffer bsrcleft m_ltbuf m_rtbuf cdifftextbuffer bsrcleft m_rtbuf m_ltbuf bsrcwasmod ismodified cd_dbegin bsrcleft cd_dend bsrcleft cd_blank bsrcleft deleted_lines cd_dend getfirstviewposition ccrystaltextview curview dynamic_cast ccrystaltextview getnextview bsrcleft curview dynamic_cast ccrystaltextview getnextview beginundogroup cd_blank cmergeeditview static_cast cmergeeditview static_cast cmdiframewnd afxgetmainwnd mdigetactive getactiveview cpoint getcursorpos cd_blank cd_blank cd_dend cd_blank setcursorpos deletetext cd_blank cd_dend ce_action_delete cd_blank cd_dend cd_blank setcursorpos deletetext cd_blank getlinelength cd_blank cd_dend getlinelength cd_dend ce_action_delete deleted_lines cd_dend cd_blank cd_blank flushundogroup curview beginundogroup cstring strline cd_dbegin setlineflag lf_winmerge_flags setlineflag lf_winmerge_flags getline strline replaceline strline flushundogroup curview beginundogroup flushundogroup m_pright replaceselection strtext psrclist invalidatelines cd_dbegin cd_dend pdestlist invalidatelines cd_dbegin cd_dend setcurrentdiff m_diffs removeat curdiff m_ndiffs deleted_lines curdiff m_ndiffs m_diffs deleted_lines deleted_lines deleted_lines deleted_lines deleted_lines deleted_lines setmodified bsrcwasmod pdestlist addmod suppressrescan flushandrescan bool c merge doc try save as c string str path bool b save success bool b left bool result true c string s c string title b save success false afx format string1 s ids filesave failed str path switch afx message box s mb yesno mb iconquestion case idyes verify title load string ids save as title if select file s str path title null false str path s if b left b save success m ltbuf save to file str path false else b save success m rtbuf save to file str path false if b save success result false break case idno break return result cmergedoc trysaveas cstring strpath bsavesuccess bleft cstring cstring bsavesuccess afxformatstring1 ids_filesave_failed strpath afxmessagebox mb_yesno mb_iconquestion loadstring ids_save_as_title selectfile strpath strpath bleft bsavesuccess m_ltbuf savetofile strpath bsavesuccess m_rtbuf savetofile strpath bsavesuccess bool c merge doc do save lpctstr sz path bool b save success bool b left c string str save path sz path b save success false if mf m strsaveaspath is empty c file status status if c file get status mf m strsaveaspath status status m attribute c file attribute directory third arg was a directory so get append the filename c string sname split filename sz path 0 sname 0 str save path mf m strsaveaspath if mf m strsaveaspath right 1 t str save path t str save path sname else str save path mf m strsaveaspath if mf check save path str save path return false if mf create backup str save path return false bool result if b left result m ltbuf save to file str save path false if result b save success true m strleftfile str save path c child frame parent dynamic cast c child frame dynamic cast cmdi frame wnd afx get main wnd mdi get active if parent parent set header text 0 m strleftfile else saving failed user may save to another location if wants to todo proper fix for handling save success here problem is we cannot return b save success because callers use it to determine if file statuses should be changed bool b save as success while result result try save as str save path b save as success b left else result m rtbuf save to file str save path false if result b save success true m strrightfile str save path c child frame parent dynamic cast c child frame dynamic cast cmdi frame wnd afx get main wnd mdi get active if parent parent set header text 1 m strrightfile else saving failed user may save to another location if wants to todo proper fix for handling save success here problem is we cannot return b save success because callers use it to determine if file statuses should be changed bool b save as success while result result try save as str save path b save as success b left return result cmergedoc dosave szpath bsavesuccess bleft cstring strsavepath szpath bsavesuccess m_strsaveaspath isempty cfilestatus cfile getstatus m_strsaveaspath m_attribute cfile cstring splitfilename szpath strsavepath m_strsaveaspath m_strsaveaspath _t strsavepath _t strsavepath strsavepath m_strsaveaspath checksavepath strsavepath createbackup strsavepath bleft m_ltbuf savetofile strsavepath bsavesuccess m_strleftfile strsavepath cchildframe dynamic_cast cchildframe dynamic_cast cmdiframewnd afxgetmainwnd mdigetactive setheadertext m_strleftfile bsavesuccess bsaveassuccess trysaveas strsavepath bsaveassuccess bleft m_rtbuf savetofile strsavepath bsavesuccess m_strrightfile strsavepath cchildframe dynamic_cast cchildframe dynamic_cast cmdiframewnd afxgetmainwnd mdigetactive setheadertext m_strrightfile bsavesuccess bsaveassuccess trysaveas strsavepath bsaveassuccess bleft int c merge doc line to diff uint n line for uint i 0 i m ndiffs i if line in diff n line i return i return 1 cmergedoc linetodiff nline m_ndiffs lineindiff nline bool c merge doc line in diff uint n line uint n diff assert n diff 0 n diff m ndiffs if n line m diffs n diff dbegin0 n line m diffs n diff dend0 return true else return false cmergedoc lineindiff nline ndiff ndiff ndiff m_ndiffs nline m_diffs ndiff nline m_diffs ndiff void c merge doc set diff view mode bool b enable if b enable else cmergedoc setdiffviewmode benable benable void c merge doc set merge views c merge edit view p left c merge edit view p right assert p left m pleftview m pleftview p left assert p right m prightview m prightview p right cmergedoc setmergeviews cmergeeditview pleft cmergeeditview pright pleft m_pleftview m_pleftview pleft pright m_prightview m_prightview pright void c merge doc set dir doc c dir doc p dir doc assert p dir doc m pdirdoc m pdirdoc p dir doc cmergedoc setdirdoc cdirdoc pdirdoc pdirdoc m_pdirdoc m_pdirdoc pdirdoc void c merge doc dir doc closing c dir doc p dir doc assert m pdirdoc p dir doc m pdirdoc 0 todo perry 2003 03 30 perhaps merge doc should close now cmergedoc dirdocclosing cdirdoc pdirdoc m_pdirdoc pdirdoc m_pdirdoc bool c merge doc close now if save helper return false get parent frame close now return true cmergedoc closenow savehelper getparentframe closenow c child frame c merge doc get parent frame return dynamic cast c child frame m pleftview get parent frame cchildframe cmergedoc getparentframe dynamic_cast cchildframe m_pleftview getparentframe bool c merge doc on new document if c document on new document return false c string s verify s load string ids file comparison title set title s m ltbuf init new m rtbuf init new return true cmergedoc onnewdocument cdocument onnewdocument cstring loadstring ids_file_comparison_title settitle m_ltbuf initnew m_rtbuf initnew void c merge doc serialize c archive ar if ar is storing todo add storing code here else todo add loading code here cmergedoc carchive isstoring bool c merge doc can close frame c frame wnd p frame if save helper set modified status to false so that we are not asking about saving again in on close document m ltbuf set modified false m rtbuf set modified false return true else return false cmergedoc cancloseframe cframewnd pframe savehelper onclosedocument m_ltbuf setmodified m_rtbuf setmodified bool c merge doc save modified return true cmergedoc savemodified void c merge doc delete contents c document delete contents m ltbuf free all m rtbuf free all cleanup temp files cmergedoc deletecontents cdocument deletecontents m_ltbuf freeall m_rtbuf freeall cleanuptempfiles bool c merge doc save helper bool result true c string s bool bl save success false bool br save success false bool bl modified false bool br modified false afx format string1 s ids save fmt m strleftfile if m ltbuf is modified bl modified true switch afx message box s mb yesnocancel mb iconquestion case idyes if do save m strleftfile bl save success true result false break case idno break default idcancel result false break afx format string1 s ids save fmt m strrightfile if m rtbuf is modified br modified true switch afx message box s mb yesnocancel mb iconquestion case idyes if do save m strrightfile br save success false result false break case idno break default idcancel result false break if file were modified and saving was successfull update status on dir view if bl modified bl save success br modified br save success if dir doc contains diffs if m pdirdoc m pctxt m pdirdoc update item times m strleftfile m strrightfile if m ndiffs 0 m pdirdoc update item status m strleftfile m strrightfile file same return result cmergedoc savehelper cstring blsavesuccess brsavesuccess blmodified brmodified afxformatstring1 ids_save_fmt m_strleftfile m_ltbuf ismodified blmodified afxmessagebox mb_yesnocancel mb_iconquestion dosave m_strleftfile blsavesuccess afxformatstring1 ids_save_fmt m_strrightfile m_rtbuf ismodified brmodified afxmessagebox mb_yesnocancel mb_iconquestion dosave m_strrightfile brsavesuccess blmodified blsavesuccess brmodified brsavesuccess dirdoc m_pdirdoc m_pctxt m_pdirdoc updateitemtimes m_strleftfile m_strrightfile m_ndiffs m_pdirdoc updateitemstatus m_strleftfile m_strrightfile file_same void c merge doc flush and rescan bool b forced false ignore suppressing when forced rescan if b forced if m benablerescan return wait status cursor waitstatus load res string ids status rescanning cmdi frame wnd main wnd dynamic cast cmdi frame wnd afx get main wnd cmdi child wnd diff wnd dynamic cast cmdi child wnd main wnd mdi get active c crystal edit view cur view dynamic cast c crystal edit view diff wnd get active view int n rescan result rescan ok if cur view cur view push cursor n rescan result rescan b forced update all views null cur view pop cursor show possible error after updating screen if n rescan result rescan ok n rescan result rescan suppressed show rescan error n rescan result else n rescan result rescan b forced update all views null show possible error after updating screen if n rescan result rescan ok n rescan result rescan suppressed show rescan error n rescan result cmergedoc flushandrescan bforced bforced m_benablerescan waitstatuscursor loadresstring ids_status_rescanning cmdiframewnd mainwnd dynamic_cast cmdiframewnd afxgetmainwnd cmdichildwnd diffwnd dynamic_cast cmdichildwnd mainwnd mdigetactive ccrystaleditview curview dynamic_cast ccrystaleditview diffwnd getactiveview nrescanresult rescan_ok curview curview pushcursor nrescanresult bforced updateallviews curview popcursor nrescanresult rescan_ok nrescanresult rescan_suppressed showrescanerror nrescanresult nrescanresult bforced updateallviews nrescanresult rescan_ok nrescanresult rescan_suppressed showrescanerror nrescanresult bool c merge doc temp files exist c file status s1 s2 return m strtempleftfile is empty c file get status m strtempleftfile s1 m strtemprightfile is empty c file get status m strtemprightfile s2 cmergedoc tempfilesexist cfilestatus m_strtempleftfile isempty cfile getstatus m_strtempleftfile m_strtemprightfile isempty cfile getstatus m_strtemprightfile void c merge doc cleanup temp files if m strtempleftfile is empty if delete file m strtempleftfile m strtempleftfile t else trace last error message if m strtemprightfile is empty if delete file m strtemprightfile m strtemprightfile t else trace last error message cmergedoc cleanuptempfiles m_strtempleftfile isempty deletefile m_strtempleftfile m_strtempleftfile _t tracelasterrormessage m_strtemprightfile isempty deletefile m_strtemprightfile m_strtemprightfile _t tracelasterrormessage bool c merge doc init temp files const c string src pathl const c string str pathr tchar str temp path max path 0 if get temp path max path str temp path return false set temp paths for buffers m ltbuf set temp path str temp path m rtbuf set temp path str temp path if m strtempleftfile is empty tchar name max path get temp file name str temp path t lt 0 name m strtempleftfile name if copy file src pathl m strtempleftfile false return false set file attributes m strtempleftfile file attribute normal if m strtemprightfile is empty tchar name max path get temp file name str temp path t rt 0 name m strtemprightfile name if copy file str pathr m strtemprightfile false return false set file attributes m strtemprightfile file attribute normal return true cmergedoc inittempfiles cstring srcpathl cstring strpathr strtemppath max_path gettemppath max_path strtemppath m_ltbuf settemppath strtemppath m_rtbuf settemppath strtemppath m_strtempleftfile isempty max_path gettempfilename strtemppath _t _lt m_strtempleftfile copyfile srcpathl m_strtempleftfile setfileattributes m_strtempleftfile file_attribute_normal m_strtemprightfile isempty max_path gettempfilename strtemppath _t _rt m_strtemprightfile copyfile strpathr m_strtemprightfile setfileattributes m_strtemprightfile file_attribute_normal void c merge doc set current diff int n diff if n diff 0 n diff int m ndiffs m ncurdiff n diff else m ncurdiff 1 cmergedoc setcurrentdiff ndiff ndiff ndiff m_ndiffs m_ncurdiff ndiff m_ncurdiff uint c merge doc count prev blanks uint n cur line bool b left uint n blanks 0 int blk end for int i 0 i int m ndiffs i if b left blk m diffs i blank0 end m diffs i dend0 else blk m diffs i blank1 end m diffs i dend0 if blk int n cur line break else if blk 0 n blanks end blk 1 return n blanks cmergedoc countprevblanks ncurline bleft nblanks m_ndiffs bleft m_diffs m_diffs m_diffs m_diffs ncurline nblanks nblanks c merge doc c merge doc c undo item pitem while m undolist is empty pitem c undo item m undolist remove head delete pitem if m pdirdoc m pdirdoc merge doc closing this m pdirdoc 0 cmergedoc cmergedoc cundoitem m_undolist isempty cundoitem m_undolist removehead m_pdirdoc m_pdirdoc mergedocclosing m_pdirdoc void c merge doc on file event wparam w event lpctstr psz path name if the app m dwflags ep notify changes return message beep mb iconexclamation c frame wnd pwnd main c frame wnd the app get main wnd assert pwnd main if pwnd main is window visible c main frame pwnd main flash until focus if w event fe modified bool b reload the app m dwflags ep auto reload 0 if b reload c string s msg s msg format ids file changed psz path name b reload afx message box s msg mb yesno mb iconquestion idyes if b reload position pos get first view position assert pos c edit pad view p view do p view c edit pad view get next view pos p view push cursor while pos m xtextbuffer free all m xtextbuffer load from file psz path name pos get first view position assert pos do p view c edit pad view get next view pos p view pop cursor hwnd h wnd p view get safe hwnd redraw window h wnd null null rdw invalidate rdw internalpaint rdw erase rdw erasenow rdw updatenow rdw noframe while pos else if w event fe deleted if the app m dwflags ep auto reload c string s msg s msg format ids file deleted psz path name afx message box s msg mb ok mb iconinformation cmergedoc onfileevent wevent pszpathname theapp m_dwflags ep_notify_changes messagebeep mb_iconexclamation cframewnd pwndmain cframewnd theapp getmainwnd pwndmain pwndmain iswindowvisible cmainframe pwndmain flashuntilfocus wevent fe_modified breload theapp m_dwflags ep_auto_reload breload cstring smsg smsg ids_file_changed pszpathname breload afxmessagebox smsg mb_yesno mb_iconquestion breload getfirstviewposition ceditpadview pview pview ceditpadview getnextview pview pushcursor m_xtextbuffer freeall m_xtextbuffer loadfromfile pszpathname getfirstviewposition pview ceditpadview getnextview pview popcursor hwnd pview getsafehwnd redrawwindow hwnd rdw_invalidate rdw_internalpaint rdw_erase rdw_erasenow rdw_updatenow rdw_noframe wevent fe_deleted theapp m_dwflags ep_auto_reload cstring smsg smsg ids_file_deleted pszpathname afxmessagebox smsg mb_ok mb_iconinformation void c merge doc on file save bool bl save success false bool br save success false bool bl modified false bool br modified false if m ltbuf is modified bl modified true do save m strleftfile bl save success true if m rtbuf is modified br modified true do save m strrightfile br save success false if file were modified and saving succeeded update status on dir view if bl modified bl save success br modified br save success if dir doc contains diffs if m pdirdoc m pctxt m pdirdoc update item times m strleftfile m strrightfile if m ndiffs 0 m pdirdoc update item status m strleftfile m strrightfile file same cmergedoc onfilesave blsavesuccess brsavesuccess blmodified brmodified m_ltbuf ismodified blmodified dosave m_strleftfile blsavesuccess m_rtbuf ismodified brmodified dosave m_strrightfile brsavesuccess blmodified blsavesuccess brmodified brsavesuccess dirdoc m_pdirdoc m_pctxt m_pdirdoc updateitemtimes m_strleftfile m_strrightfile m_ndiffs m_pdirdoc updateitemstatus m_strleftfile m_strrightfile file_same void c merge doc on update status num c cmdui p cmdui c string s idx s cnt s if get current diff 0 m ndiffs 0 s t else if get current diff 0 s cnt format t ld m ndiffs afx format string1 s ids no diff sel fmt s cnt else s idx format t ld get current diff 1 s cnt format t ld m ndiffs afx format string2 s ids diff number status fmt s idx s cnt p cmdui set text s cmergedoc onupdatestatusnum ccmdui pcmdui cstring sidx scnt getcurrentdiff m_ndiffs _t getcurrentdiff scnt _t m_ndiffs afxformatstring1 ids_no_diff_sel_fmt scnt sidx _t getcurrentdiff scnt _t m_ndiffs afxformatstring2 ids_diff_number_status_fmt sidx scnt pcmdui settext void c merge doc prime text buffers c stdio file file uint left extras 0 extra lines added to view uint right extras 0 extra lines added to view walk the diff stack and flag the line codes set current diff 1 for int n diff 0 n diff static cast int m ndiffs n diff diffrange cur diff m diffs n diff handle left only for the left view switch cur diff op case op leftonly left side just flag the lines cur diff dbegin0 cur diff begin0 left extras cur diff dend0 cur diff end0 left extras cur diff blank0 1 for uint i cur diff dbegin0 i cur diff dend0 i m ltbuf set line flag i lf left only true false false right side need to insert blanks to compensate for diff on other side cur diff dbegin1 cur diff begin1 right extras cur diff dend1 cur diff dbegin1 cur diff end0 cur diff begin0 cur diff blank1 cur diff dbegin1 for uint i cur diff dbegin1 i cur diff dend1 i m rtbuf insert line null 0 i m rtbuf set line flag i lf left only true false false right extras break case op rightonly right side just flag the lines cur diff dbegin1 cur diff begin1 right extras cur diff dend1 cur diff end1 right extras cur diff blank1 1 for uint i cur diff dbegin1 i cur diff dend1 i m rtbuf set line flag i lf right only true false false left side need to insert blanks to compensate for diff on other side cur diff dbegin0 cur diff begin0 left extras cur diff dend0 cur diff dbegin0 cur diff end1 cur diff begin1 cur diff blank0 cur diff dbegin0 for uint i cur diff dbegin0 i cur diff dend0 i m ltbuf insert line null 0 i m ltbuf set line flag i lf right only true false false left extras break case op diff left side just flag the lines cur diff dbegin0 cur diff begin0 left extras cur diff dend0 cur diff end0 left extras for uint i cur diff dbegin0 i cur diff dend0 i m ltbuf set line flag i lf diff true false false insert blanks if needed int blanks cur diff end1 cur diff begin1 cur diff end0 cur diff begin0 if blanks 0 cur diff blank0 cur diff dend0 1 cur diff blank1 1 for int b 0 b blanks b int idx cur diff blank0 b m ltbuf insert line null 0 idx m ltbuf set line flag idx lf right only true false false cur diff dend0 left extras right side just flag the lines cur diff dbegin1 cur diff begin1 right extras cur diff dend1 cur diff end1 right extras for uint i cur diff dbegin1 i cur diff dend1 i m rtbuf set line flag i lf diff true false false insert blanks if needed int blanks cur diff end0 cur diff begin0 cur diff end1 cur diff begin1 if blanks 0 cur diff blank1 cur diff dend1 1 cur diff blank0 1 for int b 0 b blanks b int idx cur diff blank1 b m rtbuf insert line null 0 idx m rtbuf set line flag idx lf left only true false false cur diff dend1 right extras break m ltbuf set read only false m rtbuf set read only false cmergedoc primetextbuffers cstdiofile leftextras rightextras setcurrentdiff ndiff ndiff static_cast m_ndiffs ndiff curdiff m_diffs ndiff curdiff op_leftonly curdiff curdiff leftextras curdiff curdiff leftextras curdiff curdiff curdiff m_ltbuf setlineflag lf_left_only curdiff curdiff rightextras curdiff curdiff curdiff curdiff curdiff curdiff curdiff curdiff m_rtbuf insertline m_rtbuf setlineflag lf_left_only rightextras op_rightonly curdiff curdiff rightextras curdiff curdiff rightextras curdiff curdiff curdiff m_rtbuf setlineflag lf_right_only curdiff curdiff leftextras curdiff curdiff curdiff curdiff curdiff curdiff curdiff curdiff m_ltbuf insertline m_ltbuf setlineflag lf_right_only leftextras op_diff curdiff curdiff leftextras curdiff curdiff leftextras curdiff curdiff m_ltbuf setlineflag lf_diff curdiff curdiff curdiff curdiff curdiff curdiff curdiff curdiff m_ltbuf insertline m_ltbuf setlineflag lf_right_only curdiff leftextras curdiff curdiff rightextras curdiff curdiff rightextras curdiff curdiff m_rtbuf setlineflag lf_diff curdiff curdiff curdiff curdiff curdiff curdiff curdiff curdiff m_rtbuf insertline m_rtbuf setlineflag lf_left_only curdiff rightextras m_ltbuf setreadonly m_rtbuf setreadonly c dialog c vss prompt idd p parent afx data init c vss prompt m strproject t m struser t m strpassword t m strmessage t afx data init cdialog cvssprompt pparent afx_data_init cvssprompt m_strproject _t m_struser _t m_strpassword _t m_strmessage _t afx_data_init void c vss prompt do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c vss prompt ddx control pdx idc project combo m ctlproject ddx cbstring pdx idc project combo m strproject ddx text pdx idc user m struser ddx text pdx idc password m strpassword ddx text pdx idc message m strmessage afx data map cvssprompt dodataexchange cdataexchange cdialog dodataexchange afx_data_map cvssprompt ddx_control idc_project_combo m_ctlproject ddx_cbstring idc_project_combo m_strproject ddx_text idc_user m_struser ddx_text idc_password m_strpassword ddx_text idc_message m_strmessage afx_data_map bool c vss prompt on init dialog c dialog on init dialog m ctlproject load state t vss return true cvssprompt oninitdialog cdialog oninitdialog m_ctlproject loadstate _t void c vss prompt onok update data true if m strproject is empty afx message box ids noproject mb iconstop m ctlproject set focus return m ctlproject save state t vss c dialog onok cvssprompt updatedata m_strproject isempty afxmessagebox ids_noproject mb_iconstop m_ctlproject setfocus m_ctlproject savestate _t cdialog void c vss prompt on saveas end dialog idsaveas cvssprompt onsaveas enddialog c string ivss item old get spec c string result invoke helper 0x1 dispatch propertyget vt bstr void result null return result cstring ivssitemold getspec cstring invokehelper dispatch_propertyget vt_bstr bool ivss item old get binary bool result invoke helper 0x2 dispatch propertyget vt bool void result null return result ivssitemold getbinary invokehelper dispatch_propertyget vt_bool void ivss item old set binary bool b new value static byte parms vts bool invoke helper 0x2 dispatch propertyput vt empty null parms b new value ivssitemold setbinary bnewvalue vts_bool invokehelper dispatch_propertyput vt_empty bnewvalue bool ivss item old get deleted bool result invoke helper 0x3 dispatch propertyget vt bool void result null return result ivssitemold getdeleted invokehelper dispatch_propertyget vt_bool void ivss item old set deleted bool b new value static byte parms vts bool invoke helper 0x3 dispatch propertyput vt empty null parms b new value ivssitemold setdeleted bnewvalue vts_bool invokehelper dispatch_propertyput vt_empty bnewvalue long ivss item old get type long result invoke helper 0x4 dispatch propertyget vt i4 void result null return result ivssitemold gettype invokehelper dispatch_propertyget vt_i4 c string ivss item old get local spec c string result invoke helper 0x5 dispatch propertyget vt bstr void result null return result cstring ivssitemold getlocalspec cstring invokehelper dispatch_propertyget vt_bstr void ivss item old set local spec lpctstr lpsz new value static byte parms vts bstr invoke helper 0x5 dispatch propertyput vt empty null parms lpsz new value ivssitemold setlocalspec lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue c string ivss item old get name c string result invoke helper 0x6 dispatch propertyget vt bstr void result null return result cstring ivssitemold getname cstring invokehelper dispatch_propertyget vt_bstr void ivss item old set name lpctstr lpsz new value static byte parms vts bstr invoke helper 0x6 dispatch propertyput vt empty null parms lpsz new value ivssitemold setname lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue lpdispatch ivss item old get parent lpdispatch result invoke helper 0x7 dispatch propertyget vt dispatch void result null return result ivssitemold getparent invokehelper dispatch_propertyget vt_dispatch long ivss item old get version number long result invoke helper 0x8 dispatch propertyget vt i4 void result null return result ivssitemold getversionnumber invokehelper dispatch_propertyget vt_i4 lpdispatch ivss item old get items bool include deleted lpdispatch result static byte parms vts bool invoke helper 0x9 dispatch propertyget vt dispatch void result parms include deleted return result ivssitemold getitems includedeleted vts_bool invokehelper dispatch_propertyget vt_dispatch includedeleted void ivss item old get bstr local long i flags static byte parms vts pbstr vts i4 invoke helper 0xa dispatch method vt empty null parms local i flags ivssitemold iflags vts_pbstr vts_i4 invokehelper dispatch_method vt_empty iflags void ivss item old checkout lpctstr comment lpctstr local long i flags static byte parms vts bstr vts bstr vts i4 invoke helper 0xb dispatch method vt empty null parms comment local i flags ivssitemold iflags vts_bstr vts_bstr vts_i4 invokehelper dispatch_method vt_empty iflags void ivss item old checkin lpctstr comment lpctstr local long i flags static byte parms vts bstr vts bstr vts i4 invoke helper 0xc dispatch method vt empty null parms comment local i flags ivssitemold iflags vts_bstr vts_bstr vts_i4 invokehelper dispatch_method vt_empty iflags void ivss item old undo checkout lpctstr local long i flags static byte parms vts bstr vts i4 invoke helper 0xd dispatch method vt empty null parms local i flags ivssitemold undocheckout iflags vts_bstr vts_i4 invokehelper dispatch_method vt_empty iflags long ivss item old get is checked out long result invoke helper 0xe dispatch propertyget vt i4 void result null return result ivssitemold getischeckedout invokehelper dispatch_propertyget vt_i4 lpdispatch ivss item old get checkouts lpdispatch result invoke helper 0xf dispatch propertyget vt dispatch void result null return result ivssitemold getcheckouts invokehelper dispatch_propertyget vt_dispatch bool ivss item old get is different lpctstr local bool result static byte parms vts bstr invoke helper 0x10 dispatch propertyget vt bool void result parms local return result ivssitemold getisdifferent vts_bstr invokehelper dispatch_propertyget vt_bool lpdispatch ivss item old add lpctstr local lpctstr comment long i flags lpdispatch result static byte parms vts bstr vts bstr vts i4 invoke helper 0x11 dispatch method vt dispatch void result parms local comment i flags return result ivssitemold iflags vts_bstr vts_bstr vts_i4 invokehelper dispatch_method vt_dispatch iflags lpdispatch ivss item old new subproject lpctstr name lpctstr comment lpdispatch result static byte parms vts bstr vts bstr invoke helper 0x12 dispatch method vt dispatch void result parms name comment return result ivssitemold newsubproject vts_bstr vts_bstr invokehelper dispatch_method vt_dispatch void ivss item old share lpdispatch pi item lpctstr comment long i flags static byte parms vts dispatch vts bstr vts i4 invoke helper 0x13 dispatch method vt empty null parms pi item comment i flags ivssitemold piitem iflags vts_dispatch vts_bstr vts_i4 invokehelper dispatch_method vt_empty piitem iflags void ivss item old destroy invoke helper 0x14 dispatch method vt empty null null ivssitemold invokehelper dispatch_method vt_empty void ivss item old move lpdispatch pi new parent static byte parms vts dispatch invoke helper 0x15 dispatch method vt empty null parms pi new parent ivssitemold pinewparent vts_dispatch invokehelper dispatch_method vt_empty pinewparent void ivss item old label lpctstr label lpctstr comment static byte parms vts bstr vts bstr invoke helper 0x16 dispatch method vt empty null parms label comment ivssitemold vts_bstr vts_bstr invokehelper dispatch_method vt_empty lpdispatch ivss item old get versions long i flags lpdispatch result static byte parms vts i4 invoke helper 0x17 dispatch propertyget vt dispatch void result parms i flags return result ivssitemold getversions iflags vts_i4 invokehelper dispatch_propertyget vt_dispatch iflags lpdispatch ivss item old get version const variant version lpdispatch result static byte parms vts variant invoke helper 0x18 dispatch propertyget vt dispatch void result parms version return result ivssitemold getversion vts_variant invokehelper dispatch_propertyget vt_dispatch c string ivss item get spec c string result invoke helper 0x1 dispatch propertyget vt bstr void result null return result cstring ivssitem getspec cstring invokehelper dispatch_propertyget vt_bstr bool ivss item get binary bool result invoke helper 0x2 dispatch propertyget vt bool void result null return result ivssitem getbinary invokehelper dispatch_propertyget vt_bool void ivss item set binary bool b new value static byte parms vts bool invoke helper 0x2 dispatch propertyput vt empty null parms b new value ivssitem setbinary bnewvalue vts_bool invokehelper dispatch_propertyput vt_empty bnewvalue bool ivss item get deleted bool result invoke helper 0x3 dispatch propertyget vt bool void result null return result ivssitem getdeleted invokehelper dispatch_propertyget vt_bool void ivss item set deleted bool b new value static byte parms vts bool invoke helper 0x3 dispatch propertyput vt empty null parms b new value ivssitem setdeleted bnewvalue vts_bool invokehelper dispatch_propertyput vt_empty bnewvalue long ivss item get type long result invoke helper 0x4 dispatch propertyget vt i4 void result null return result ivssitem gettype invokehelper dispatch_propertyget vt_i4 c string ivss item get local spec c string result invoke helper 0x5 dispatch propertyget vt bstr void result null return result cstring ivssitem getlocalspec cstring invokehelper dispatch_propertyget vt_bstr void ivss item set local spec lpctstr lpsz new value static byte parms vts bstr invoke helper 0x5 dispatch propertyput vt empty null parms lpsz new value ivssitem setlocalspec lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue c string ivss item get name c string result invoke helper 0x6 dispatch propertyget vt bstr void result null return result cstring ivssitem getname cstring invokehelper dispatch_propertyget vt_bstr void ivss item set name lpctstr lpsz new value static byte parms vts bstr invoke helper 0x6 dispatch propertyput vt empty null parms lpsz new value ivssitem setname lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue lpdispatch ivss item get parent lpdispatch result invoke helper 0x7 dispatch propertyget vt dispatch void result null return result ivssitem getparent invokehelper dispatch_propertyget vt_dispatch long ivss item get version number long result invoke helper 0x8 dispatch propertyget vt i4 void result null return result ivssitem getversionnumber invokehelper dispatch_propertyget vt_i4 lpdispatch ivss item get items bool include deleted lpdispatch result static byte parms vts bool invoke helper 0x9 dispatch propertyget vt dispatch void result parms include deleted return result ivssitem getitems includedeleted vts_bool invokehelper dispatch_propertyget vt_dispatch includedeleted void ivss item get bstr local long i flags static byte parms vts pbstr vts i4 invoke helper 0xa dispatch method vt empty null parms local i flags ivssitem iflags vts_pbstr vts_i4 invokehelper dispatch_method vt_empty iflags void ivss item checkout lpctstr comment lpctstr local long i flags static byte parms vts bstr vts bstr vts i4 invoke helper 0xb dispatch method vt empty null parms comment local i flags ivssitem iflags vts_bstr vts_bstr vts_i4 invokehelper dispatch_method vt_empty iflags void ivss item checkin lpctstr comment lpctstr local long i flags static byte parms vts bstr vts bstr vts i4 invoke helper 0xc dispatch method vt empty null parms comment local i flags ivssitem iflags vts_bstr vts_bstr vts_i4 invokehelper dispatch_method vt_empty iflags void ivss item undo checkout lpctstr local long i flags static byte parms vts bstr vts i4 invoke helper 0xd dispatch method vt empty null parms local i flags ivssitem undocheckout iflags vts_bstr vts_i4 invokehelper dispatch_method vt_empty iflags long ivss item get is checked out long result invoke helper 0xe dispatch propertyget vt i4 void result null return result ivssitem getischeckedout invokehelper dispatch_propertyget vt_i4 lpdispatch ivss item get checkouts lpdispatch result invoke helper 0xf dispatch propertyget vt dispatch void result null return result ivssitem getcheckouts invokehelper dispatch_propertyget vt_dispatch bool ivss item get is different lpctstr local bool result static byte parms vts bstr invoke helper 0x10 dispatch propertyget vt bool void result parms local return result ivssitem getisdifferent vts_bstr invokehelper dispatch_propertyget vt_bool lpdispatch ivss item add lpctstr local lpctstr comment long i flags lpdispatch result static byte parms vts bstr vts bstr vts i4 invoke helper 0x11 dispatch method vt dispatch void result parms local comment i flags return result ivssitem iflags vts_bstr vts_bstr vts_i4 invokehelper dispatch_method vt_dispatch iflags lpdispatch ivss item new subproject lpctstr name lpctstr comment lpdispatch result static byte parms vts bstr vts bstr invoke helper 0x12 dispatch method vt dispatch void result parms name comment return result ivssitem newsubproject vts_bstr vts_bstr invokehelper dispatch_method vt_dispatch void ivss item share lpdispatch pi item lpctstr comment long i flags static byte parms vts dispatch vts bstr vts i4 invoke helper 0x13 dispatch method vt empty null parms pi item comment i flags ivssitem piitem iflags vts_dispatch vts_bstr vts_i4 invokehelper dispatch_method vt_empty piitem iflags void ivss item destroy invoke helper 0x14 dispatch method vt empty null null ivssitem invokehelper dispatch_method vt_empty void ivss item move lpdispatch pi new parent static byte parms vts dispatch invoke helper 0x15 dispatch method vt empty null parms pi new parent ivssitem pinewparent vts_dispatch invokehelper dispatch_method vt_empty pinewparent void ivss item label lpctstr label lpctstr comment static byte parms vts bstr vts bstr invoke helper 0x16 dispatch method vt empty null parms label comment ivssitem vts_bstr vts_bstr invokehelper dispatch_method vt_empty lpdispatch ivss item get versions long i flags lpdispatch result static byte parms vts i4 invoke helper 0x17 dispatch propertyget vt dispatch void result parms i flags return result ivssitem getversions iflags vts_i4 invokehelper dispatch_propertyget vt_dispatch iflags lpdispatch ivss item get version const variant version lpdispatch result static byte parms vts variant invoke helper 0x18 dispatch propertyget vt dispatch void result parms version return result ivssitem getversion vts_variant invokehelper dispatch_propertyget vt_dispatch lpdispatch ivss item get links lpdispatch result invoke helper 0x19 dispatch propertyget vt dispatch void result null return result ivssitem getlinks invokehelper dispatch_propertyget vt_dispatch lpdispatch ivss item branch lpctstr comment long i flags lpdispatch result static byte parms vts bstr vts i4 invoke helper 0x1a dispatch method vt dispatch void result parms comment i flags return result ivssitem iflags vts_bstr vts_i4 invokehelper dispatch_method vt_dispatch iflags c string ivss version old get username c string result invoke helper 0x1 dispatch propertyget vt bstr void result null return result cstring ivssversionold getusername cstring invokehelper dispatch_propertyget vt_bstr long ivss version old get version number long result invoke helper 0x2 dispatch propertyget vt i4 void result null return result ivssversionold getversionnumber invokehelper dispatch_propertyget vt_i4 c string ivss version old get action c string result invoke helper 0x3 dispatch propertyget vt bstr void result null return result cstring ivssversionold getaction cstring invokehelper dispatch_propertyget vt_bstr date ivss version old get date date result invoke helper 0x4 dispatch propertyget vt date void result null return result ivssversionold getdate invokehelper dispatch_propertyget vt_date c string ivss version old get comment c string result invoke helper 0x5 dispatch propertyget vt bstr void result null return result cstring ivssversionold getcomment cstring invokehelper dispatch_propertyget vt_bstr c string ivss version old get label c string result invoke helper 0x6 dispatch propertyget vt bstr void result null return result cstring ivssversionold getlabel cstring invokehelper dispatch_propertyget vt_bstr lpdispatch ivss version old getvss item lpdispatch result invoke helper 0x7 dispatch propertyget vt dispatch void result null return result ivssversionold getvssitem invokehelper dispatch_propertyget vt_dispatch c string ivss version get username c string result invoke helper 0x1 dispatch propertyget vt bstr void result null return result cstring ivssversion getusername cstring invokehelper dispatch_propertyget vt_bstr long ivss version get version number long result invoke helper 0x2 dispatch propertyget vt i4 void result null return result ivssversion getversionnumber invokehelper dispatch_propertyget vt_i4 c string ivss version get action c string result invoke helper 0x3 dispatch propertyget vt bstr void result null return result cstring ivssversion getaction cstring invokehelper dispatch_propertyget vt_bstr date ivss version get date date result invoke helper 0x4 dispatch propertyget vt date void result null return result ivssversion getdate invokehelper dispatch_propertyget vt_date c string ivss version get comment c string result invoke helper 0x5 dispatch propertyget vt bstr void result null return result cstring ivssversion getcomment cstring invokehelper dispatch_propertyget vt_bstr c string ivss version get label c string result invoke helper 0x6 dispatch propertyget vt bstr void result null return result cstring ivssversion getlabel cstring invokehelper dispatch_propertyget vt_bstr lpdispatch ivss version getvss item lpdispatch result invoke helper 0x7 dispatch propertyget vt dispatch void result null return result ivssversion getvssitem invokehelper dispatch_propertyget vt_dispatch c string ivss version get label comment c string result invoke helper 0x8 dispatch propertyget vt bstr void result null return result cstring ivssversion getlabelcomment cstring invokehelper dispatch_propertyget vt_bstr long ivss items get count long result invoke helper 0x1 dispatch propertyget vt i4 void result null return result ivssitems getcount invokehelper dispatch_propertyget vt_i4 lpdispatch ivss items get item const variant s item lpdispatch result static byte parms vts variant invoke helper 0x0 dispatch propertyget vt dispatch void result parms s item return result ivssitems getitem sitem vts_variant invokehelper dispatch_propertyget vt_dispatch sitem long ivss checkouts get count long result invoke helper 0x1 dispatch propertyget vt i4 void result null return result ivsscheckouts getcount invokehelper dispatch_propertyget vt_i4 lpdispatch ivss checkouts get item const variant s item lpdispatch result static byte parms vts variant invoke helper 0x0 dispatch propertyget vt dispatch void result parms s item return result ivsscheckouts getitem sitem vts_variant invokehelper dispatch_propertyget vt_dispatch sitem c string ivss checkout get username c string result invoke helper 0x1 dispatch propertyget vt bstr void result null return result cstring ivsscheckout getusername cstring invokehelper dispatch_propertyget vt_bstr date ivss checkout get date date result invoke helper 0x2 dispatch propertyget vt date void result null return result ivsscheckout getdate invokehelper dispatch_propertyget vt_date c string ivss checkout get local spec c string result invoke helper 0x3 dispatch propertyget vt bstr void result null return result cstring ivsscheckout getlocalspec cstring invokehelper dispatch_propertyget vt_bstr c string ivss checkout get machine c string result invoke helper 0x4 dispatch propertyget vt bstr void result null return result cstring ivsscheckout getmachine cstring invokehelper dispatch_propertyget vt_bstr c string ivss checkout get project c string result invoke helper 0x5 dispatch propertyget vt bstr void result null return result cstring ivsscheckout getproject cstring invokehelper dispatch_propertyget vt_bstr c string ivss checkout get comment c string result invoke helper 0x6 dispatch propertyget vt bstr void result null return result cstring ivsscheckout getcomment cstring invokehelper dispatch_propertyget vt_bstr long ivss checkout get version number long result invoke helper 0x7 dispatch propertyget vt i4 void result null return result ivsscheckout getversionnumber invokehelper dispatch_propertyget vt_i4 void ivss database old open lpctstr src safe ini lpctstr username lpctstr password static byte parms vts bstr vts bstr vts bstr invoke helper 0x1 dispatch method vt empty null parms src safe ini username password ivssdatabaseold srcsafeini vts_bstr vts_bstr vts_bstr invokehelper dispatch_method vt_empty srcsafeini c string ivss database old get src safe ini c string result invoke helper 0x2 dispatch propertyget vt bstr void result null return result cstring ivssdatabaseold getsrcsafeini cstring invokehelper dispatch_propertyget vt_bstr c string ivss database old get database name c string result invoke helper 0x3 dispatch propertyget vt bstr void result null return result cstring ivssdatabaseold getdatabasename cstring invokehelper dispatch_propertyget vt_bstr c string ivss database old get username c string result invoke helper 0x4 dispatch propertyget vt bstr void result null return result cstring ivssdatabaseold getusername cstring invokehelper dispatch_propertyget vt_bstr c string ivss database old get current project c string result invoke helper 0x5 dispatch propertyget vt bstr void result null return result cstring ivssdatabaseold getcurrentproject cstring invokehelper dispatch_propertyget vt_bstr void ivss database old set current project lpctstr lpsz new value static byte parms vts bstr invoke helper 0x5 dispatch propertyput vt empty null parms lpsz new value ivssdatabaseold setcurrentproject lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue lpdispatch ivss database old getvss item lpctstr spec bool deleted lpdispatch result static byte parms vts bstr vts bool invoke helper 0x6 dispatch propertyget vt dispatch void result parms spec deleted return result ivssdatabaseold getvssitem vts_bstr vts_bool invokehelper dispatch_propertyget vt_dispatch void ivss database open lpctstr src safe ini lpctstr username lpctstr password static byte parms vts bstr vts bstr vts bstr invoke helper 0x1 dispatch method vt empty null parms src safe ini username password ivssdatabase srcsafeini vts_bstr vts_bstr vts_bstr invokehelper dispatch_method vt_empty srcsafeini c string ivss database get src safe ini c string result invoke helper 0x2 dispatch propertyget vt bstr void result null return result cstring ivssdatabase getsrcsafeini cstring invokehelper dispatch_propertyget vt_bstr c string ivss database get database name c string result invoke helper 0x3 dispatch propertyget vt bstr void result null return result cstring ivssdatabase getdatabasename cstring invokehelper dispatch_propertyget vt_bstr c string ivss database get username c string result invoke helper 0x4 dispatch propertyget vt bstr void result null return result cstring ivssdatabase getusername cstring invokehelper dispatch_propertyget vt_bstr c string ivss database get current project c string result invoke helper 0x5 dispatch propertyget vt bstr void result null return result cstring ivssdatabase getcurrentproject cstring invokehelper dispatch_propertyget vt_bstr void ivss database set current project lpctstr lpsz new value static byte parms vts bstr invoke helper 0x5 dispatch propertyput vt empty null parms lpsz new value ivssdatabase setcurrentproject lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue lpdispatch ivss database getvss item lpctstr spec bool deleted lpdispatch result static byte parms vts bstr vts bool invoke helper 0x6 dispatch propertyget vt dispatch void result parms spec deleted return result ivssdatabase getvssitem vts_bstr vts_bool invokehelper dispatch_propertyget vt_dispatch lpdispatch ivss database add user lpctstr user lpctstr password bool read only lpdispatch result static byte parms vts bstr vts bstr vts bool invoke helper 0x7 dispatch method vt dispatch void result parms user password read only return result ivssdatabase adduser readonly vts_bstr vts_bstr vts_bool invokehelper dispatch_method vt_dispatch readonly lpdispatch ivss database get user lpctstr name lpdispatch result static byte parms vts bstr invoke helper 0x8 dispatch propertyget vt dispatch void result parms name return result ivssdatabase getuser vts_bstr invokehelper dispatch_propertyget vt_dispatch lpdispatch ivss database get users lpdispatch result invoke helper 0x9 dispatch propertyget vt dispatch void result null return result ivssdatabase getusers invokehelper dispatch_propertyget vt_dispatch bool ivss database get project rights enabled bool result invoke helper 0xa dispatch propertyget vt bool void result null return result ivssdatabase getprojectrightsenabled invokehelper dispatch_propertyget vt_bool void ivss database set project rights enabled bool b new value static byte parms vts bool invoke helper 0xa dispatch propertyput vt empty null parms b new value ivssdatabase setprojectrightsenabled bnewvalue vts_bool invokehelper dispatch_propertyput vt_empty bnewvalue long ivss database get default project rights long result invoke helper 0xb dispatch propertyget vt i4 void result null return result ivssdatabase getdefaultprojectrights invokehelper dispatch_propertyget vt_i4 void ivss database set default project rights long n new value static byte parms vts i4 invoke helper 0xb dispatch propertyput vt empty null parms n new value ivssdatabase setdefaultprojectrights nnewvalue vts_i4 invokehelper dispatch_propertyput vt_empty nnewvalue void ivss user delete invoke helper 0x1 dispatch method vt empty null null ivssuser invokehelper dispatch_method vt_empty c string ivss user get name c string result invoke helper 0x2 dispatch propertyget vt bstr void result null return result cstring ivssuser getname cstring invokehelper dispatch_propertyget vt_bstr void ivss user set name lpctstr lpsz new value static byte parms vts bstr invoke helper 0x2 dispatch propertyput vt empty null parms lpsz new value ivssuser setname lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue void ivss user set password lpctstr lpsz new value static byte parms vts bstr invoke helper 0x3 dispatch propertyput vt empty null parms lpsz new value ivssuser setpassword lpsznewvalue vts_bstr invokehelper dispatch_propertyput vt_empty lpsznewvalue bool ivss user get read only bool result invoke helper 0x4 dispatch propertyget vt bool void result null return result ivssuser getreadonly invokehelper dispatch_propertyget vt_bool void ivss user set read only bool b new value static byte parms vts bool invoke helper 0x4 dispatch propertyput vt empty null parms b new value ivssuser setreadonly bnewvalue vts_bool invokehelper dispatch_propertyput vt_empty bnewvalue long ivss user get project rights lpctstr project long result static byte parms vts bstr invoke helper 0x5 dispatch propertyget vt i4 void result parms project return result ivssuser getprojectrights vts_bstr invokehelper dispatch_propertyget vt_i4 void ivss user set project rights lpctstr project long n new value static byte parms vts bstr vts i4 invoke helper 0x5 dispatch propertyput vt empty null parms project n new value ivssuser setprojectrights nnewvalue vts_bstr vts_i4 invokehelper dispatch_propertyput vt_empty nnewvalue void ivss user remove project rights lpctstr project static byte parms vts bstr invoke helper 0x6 dispatch method vt empty null parms project ivssuser removeprojectrights vts_bstr invokehelper dispatch_method vt_empty long ivss users get count long result invoke helper 0x1 dispatch propertyget vt i4 void result null return result ivssusers getcount invokehelper dispatch_propertyget vt_i4 lpdispatch ivss users get item const variant s item lpdispatch result static byte parms vts variant invoke helper 0x0 dispatch propertyget vt dispatch void result parms s item return result ivssusers getitem sitem vts_variant invokehelper dispatch_propertyget vt_dispatch sitem lpdispatch ivss getvss database lpdispatch result invoke helper 0x1 dispatch propertyget vt dispatch void result null return result getvssdatabase invokehelper dispatch_propertyget vt_dispatch c splash wnd c splash wnd csplashwnd csplashwnd void c splash wnd enable splash screen bool b enable true c bshowsplashwnd b enable csplashwnd enablesplashscreen benable c_bshowsplashwnd benable void c splash wnd show splash screen c wnd p parent wnd null if c bshowsplashwnd c psplashwnd null return allocate a new splash screen and create the window c psplashwnd new c splash wnd if c psplashwnd create p parent wnd delete c psplashwnd else c psplashwnd update window csplashwnd showsplashscreen cwnd pparentwnd c_bshowsplashwnd c_psplashwnd c_psplashwnd csplashwnd c_psplashwnd pparentwnd c_psplashwnd c_psplashwnd updatewindow bool c splash wnd pre translate app message msg p msg if c psplashwnd null return false if we get a keyboard or mouse message hide the splash screen if p msg message wm keydown p msg message wm syskeydown p msg message wm lbuttondown p msg message wm rbuttondown p msg message wm mbuttondown p msg message wm nclbuttondown p msg message wm ncrbuttondown p msg message wm ncmbuttondown c psplashwnd hide splash screen return true message handled here return false message not handled csplashwnd pretranslateappmessage pmsg c_psplashwnd pmsg wm_keydown pmsg wm_syskeydown pmsg wm_lbuttondown pmsg wm_rbuttondown pmsg wm_mbuttondown pmsg wm_nclbuttondown pmsg wm_ncrbuttondown pmsg wm_ncmbuttondown c_psplashwnd hidesplashscreen c splash wnd c splash wnd clear the static window pointer assert c psplashwnd this c psplashwnd null csplashwnd csplashwnd c_psplashwnd c_psplashwnd void c splash wnd post nc destroy free the c class delete this csplashwnd postncdestroy bool c splash wnd create c wnd p parent wnd null if m bitmap load bitmap idb splash return false bitmap bm m bitmap get bitmap bm return create ex 0 afx register wnd class 0 afx get app load standard cursor idc arrow null ws popup ws visible 0 0 bm bm width bm bm height p parent wnd get safe hwnd null csplashwnd cwnd pparentwnd m_bitmap loadbitmap idb_splash m_bitmap getbitmap createex afxregisterwndclass afxgetapp loadstandardcursor idc_arrow ws_popup ws_visible bmwidth bmheight pparentwnd getsafehwnd void c splash wnd hide splash screen destroy the window and update the mainframe destroy window afx get main wnd update window csplashwnd hidesplashscreen destroywindow afxgetmainwnd updatewindow int c splash wnd on create lpcreatestruct lp create struct if c wnd on create lp create struct 1 return 1 center the window center window set a timer to destroy the splash screen set timer 1 5000 null return 0 csplashwnd oncreate lpcreatestruct cwnd oncreate lpcreatestruct centerwindow settimer void c splash wnd on paint c paintdc dc this cdc dc image if dc image create compatibledc dc return bitmap bm m bitmap get bitmap bm paint the image c bitmap p old bitmap dc image select object m bitmap dc bit blt 0 0 bm bm width bm bm height dc image 0 0 srccopy dc image select object p old bitmap c version info version c string s c font ft oldfont null if ft create point font 100 t arial dc oldfont dc select object ft c string s version version get fixed product version afx format string1 s ids version fmt s version dc set bk mode transparent dc text out 90 110 s if oldfont null dc select object oldfont csplashwnd onpaint cpaintdc dcimage dcimage createcompatibledc m_bitmap getbitmap cbitmap poldbitmap dcimage selectobject m_bitmap bitblt bmwidth bmheight dcimage dcimage selectobject poldbitmap cversioninfo cstring cfont createpointfont _t selectobject cstring sversion getfixedproductversion afxformatstring1 ids_version_fmt sversion setbkmode textout selectobject void c splash wnd on timer uint nid event destroy the splash screen window hide splash screen csplashwnd ontimer nidevent hidesplashscreen c prop vss c prop vss c property page c prop vss idd afx data init c prop vss m strpath t m nversys 1 afx data init cpropvss cpropvss cpropertypage cpropvss afx_data_init cpropvss m_strpath _t m_nversys afx_data_init c prop vss c prop vss cpropvss cpropvss void c prop vss do data exchange c data exchange pdx c property page do data exchange pdx afx data map c prop vss ddx control pdx idc vss l1 m ctlvssl1 ddx control pdx idc path edit m ctlpath ddx control pdx idc browse button m ctlbrowse ddx text pdx idc path edit m strpath ddx cbindex pdx idc ver sys m nversys afx data map cpropvss dodataexchange cdataexchange cpropertypage dodataexchange afx_data_map cpropvss ddx_control idc_vss_l1 m_ctlvssl1 ddx_control idc_path_edit m_ctlpath ddx_control idc_browse_button m_ctlbrowse ddx_text idc_path_edit m_strpath ddx_cbindex idc_ver_sys m_nversys afx_data_map void c prop vss on browse button c string s if choose file s update data true m strpath s update data false cpropvss onbrowsebutton cstring choosefile updatedata m_strpath updatedata bool c prop vss on init dialog c property page on init dialog update data false on selendok ver sys return true cpropvss oninitdialog cpropertypage oninitdialog updatedata onselendokversys void c prop vss on selendok ver sys update data true c string temp str lpcstr m nversys 3 ids cc cmd ids vss cmd m ctlvssl1 set window text temp str m ctlpath enable window m nversys 1 m nversys 3 m ctlvssl1 enable window m nversys 1 m nversys 3 m ctlbrowse enable window m nversys 1 m nversys 3 cpropvss onselendokversys updatedata cstring tempstr m_nversys ids_cc_cmd ids_vss_cmd m_ctlvssl1 setwindowtext tempstr m_ctlpath enablewindow m_nversys m_nversys m_ctlvssl1 enablewindow m_nversys m_nversys m_ctlbrowse enablewindow m_nversys m_nversys c prop syntax c prop syntax c property page c prop syntax idd afx data init c prop syntax m bhilitesyntax false afx data init cpropsyntax cpropsyntax cpropertypage cpropsyntax afx_data_init cpropsyntax m_bhilitesyntax afx_data_init c prop syntax c prop syntax cpropsyntax cpropsyntax void c prop syntax do data exchange c data exchange pdx c property page do data exchange pdx afx data map c prop syntax ddx check pdx idc hilite check m bhilitesyntax afx data map cpropsyntax dodataexchange cdataexchange cpropertypage dodataexchange afx_data_map cpropsyntax ddx_check idc_hilite_check m_bhilitesyntax afx_data_map c prop general c prop general c property page c prop general idd afx data init c prop general m bbackup false m bscroll false m ntabsize 0 m bignorecase false m bignoreblanklines false m beolsensitive false m bdisablesplash false m nignorewhite 1 m ntabtype 0 m bautomaticrescan false afx data init cpropgeneral cpropgeneral cpropertypage cpropgeneral afx_data_init cpropgeneral m_bbackup m_bscroll m_ntabsize m_bignorecase m_bignoreblanklines m_beolsensitive m_bdisablesplash m_nignorewhite m_ntabtype m_bautomaticrescan afx_data_init c prop general c prop general cpropgeneral cpropgeneral void c prop general do data exchange c data exchange pdx c property page do data exchange pdx afx data map c prop general ddx check pdx idc backup check m bbackup ddx check pdx idc scroll check m bscroll ddx text pdx idc tab edit m ntabsize ddv minmaxint pdx m ntabsize 0 64 ddx check pdx idc igncase check m bignorecase ddx check pdx idc ignblanks check m bignoreblanklines ddx check pdx idc eol sensitive m beolsensitive ddx check pdx idc disable splash m bdisablesplash ddx radio pdx idc whitespace m nignorewhite ddx radio pdx idc prop insert tabs m ntabtype ddx check pdx idc automrescan check m bautomaticrescan afx data map cpropgeneral dodataexchange cdataexchange cpropertypage dodataexchange afx_data_map cpropgeneral ddx_check idc_backup_check m_bbackup ddx_check idc_scroll_check m_bscroll ddx_text idc_tab_edit m_ntabsize ddv_minmaxint m_ntabsize ddx_check idc_igncase_check m_bignorecase ddx_check idc_ignblanks_check m_bignoreblanklines ddx_check idc_eol_sensitive m_beolsensitive ddx_check idc_disable_splash m_bdisablesplash ddx_radio idc_whitespace m_nignorewhite ddx_radio idc_prop_insert_tabs m_ntabtype ddx_check idc_automrescan_check m_bautomaticrescan afx_data_map bool c prop general on init dialog c property page on init dialog uncheck and disable the ignore blanks option it is broken check dlg button idc ignblanks check 0 get dlg item idc ignblanks check enable window false enable disable the sensitive to eol button on any whitespace change return true return true unless you set the focus to a control cpropgeneral oninitdialog cpropertypage oninitdialog checkdlgbutton idc_ignblanks_check getdlgitem idc_ignblanks_check enablewindow onanywhitespacechange void c prop general on any whitespace change todo add your control notification handler code here if is dlg button checked idc whitespace get dlg item idc eol sensitive enable window true else get dlg item idc eol sensitive enable window false check dlg button idc eol sensitive 0 m beolsensitive false cpropgeneral onanywhitespacechange isdlgbuttonchecked idc_whitespace getdlgitem idc_eol_sensitive enablewindow getdlgitem idc_eol_sensitive enablewindow checkdlgbutton idc_eol_sensitive m_beolsensitive m filters file filters afx data init c prop filter m bignoreregexp false m spattern t afx data init m sfilefilterpath selected m_filters filefilters afx_data_init cpropfilter m_bignoreregexp m_spattern _t afx_data_init m_sfilefilterpath c prop filter c prop filter cpropfilter cpropfilter int c prop filter add filter int i c string name if i 0 name m filters get at i second else name t none todo globalize int index m cbofilefilter add string name m cbofilefilter set item data index i return index cpropfilter addfilter cstring m_filters getat _t m_cbofilefilter addstring m_cbofilefilter setitemdata void c prop filter do data exchange c data exchange pdx c property page do data exchange pdx afx data map c prop filter ddx control pdx idc file filter m cbofilefilter ddx control pdx idc editpattern m cpattern ddx check pdx idc ignoreregexp m bignoreregexp ddx text pdx idc editpattern m spattern afx data map cpropfilter dodataexchange cdataexchange cpropertypage dodataexchange afx_data_map cpropfilter ddx_control idc_file_filter m_cbofilefilter ddx_control idc_editpattern m_cpattern ddx_check idc_ignoreregexp m_bignoreregexp ddx_text idc_editpattern m_spattern afx_data_map bool c prop filter on init dialog c property page on init dialog add filter 1 int sel 0 if m filters for int i 0 i m filters get size i int index add filter i if m sfilefilterpath m filters get at i first sel index m cbofilefilter set cur sel sel m cpattern enable window m bignoreregexp return true return true unless you set the focus to a control exception ocx property pages should return false cpropfilter oninitdialog cpropertypage oninitdialog addfilter m_filters m_filters getsize addfilter m_sfilefilterpath m_filters getat m_cbofilefilter setcursel m_cpattern enablewindow m_bignoreregexp void c prop filter on ignoreregexp update data enable or disable the edit box according to the value of the check box m cpattern enable window m bignoreregexp if m bignoreregexp m cpattern set focus cpropfilter onignoreregexp updatedata m_cpattern enablewindow m_bignoreregexp m_bignoreregexp m_cpattern setfocus void c prop filter on selchange file filter int index m cbofilefilter get cur sel if index 0 cannot edit 0 none m sfilefilterpath t else int nfilter m cbofilefilter get item data index m sfilefilterpath m filters get at nfilter first cpropfilter onselchangefilefilter m_cbofilefilter getcursel m_sfilefilterpath _t m_cbofilefilter getitemdata m_sfilefilterpath m_filters getat c color button c color button colorref clr fill m clrfill clr fill ccolorbutton ccolorbutton clrfill m_clrfill clrfill void c color button set color colorref clr fill m clrfill clr fill invalidate ccolorbutton setcolor clrfill m_clrfill clrfill void c color button draw item lpdrawitemstruct lp draw item struct c brush brush brush create solid brush m clrfill fill rect lp draw item struct hdc lp draw item struct rc item brush if 0 frame rect lp draw item struct hdc lp draw item struct rc item hbrush get stock object black brush endif ccolorbutton drawitem lpdrawitemstruct cbrush createsolidbrush m_clrfill fillrect lpdrawitemstruct lpdrawitemstruct rcitem framerect lpdrawitemstruct lpdrawitemstruct rcitem getstockobject black_brush c color button c color button ccolorbutton ccolorbutton m cdiff clr diff m cseldiff clr sel diff afx data init c prop colors note the class wizard will add member initialization here afx data init m_cdiff clrdiff m_cseldiff clrseldiff afx_data_init cpropcolors classwizard afx_data_init void c prop colors do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c prop colors ddx control pdx idc sel difference color m cseldiff ddx control pdx idc difference color m cdiff afx data map cpropcolors dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpropcolors ddx_control idc_sel_difference_color m_cseldiff ddx_control idc_difference_color m_cdiff afx_data_map void c prop colors load custom colors for int i 0 i custom colors amount i c string s entry s entry format d i m ccustcolors i afx get app get profile int section s entry rgb 255 255 255 cpropcolors loadcustomcolors customcolorsamount cstring sentry sentry m_ccustcolors afxgetapp getprofileint sentry void c prop colors save custom colors for int i 0 i custom colors amount i c string s entry s entry format d i if m ccustcolors i rgb 255 255 255 afx get app write profile string section s entry null else afx get app write profile int section s entry m ccustcolors i cpropcolors savecustomcolors customcolorsamount cstring sentry sentry m_ccustcolors afxgetapp writeprofilestring sentry afxgetapp writeprofileint sentry m_ccustcolors void c prop colors on difference color c color dialog dialog m clrdiff load custom colors dialog m cc lp cust colors m ccustcolors if dialog do modal idok m clrdiff dialog get color m cdiff set color m clrdiff save custom colors cpropcolors ondifferencecolor ccolordialog m_clrdiff loadcustomcolors m_cc lpcustcolors m_ccustcolors domodal m_clrdiff getcolor m_cdiff setcolor m_clrdiff savecustomcolors void c prop colors on sel difference color c color dialog dialog m clrseldiff load custom colors dialog m cc lp cust colors m ccustcolors if dialog do modal idok m clrseldiff dialog get color m cseldiff set color m clrseldiff save custom colors cpropcolors onseldifferencecolor ccolordialog m_clrseldiff loadcustomcolors m_cc lpcustcolors m_ccustcolors domodal m_clrseldiff getcolor m_cseldiff setcolor m_clrseldiff savecustomcolors m stext s text afx data init c output dlg note the class wizard will add member initialization here afx data init m_stext stext afx_data_init coutputdlg classwizard afx_data_init void c output dlg do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c output dlg note the class wizard will add ddx and ddv calls here afx data map coutputdlg dodataexchange cdataexchange cdialog dodataexchange afx_data_map coutputdlg classwizard afx_data_map bool c output dlg on init dialog c dialog on init dialog set window text m stitle set dlg item text idc edit1 m stext return true return true unless you set the focus to a control exception ocx property pages should return false coutputdlg oninitdialog cdialog oninitdialog setwindowtext m_stitle setdlgitemtext idc_edit1 m_stext c merge edit view c merge edit view m bisleft false m nmodifications 0 set parser m xparser m bautomaticrescan false cmergeeditview cmergeeditview m_bisleft m_nmodifications setparser m_xparser m_bautomaticrescan bool c merge edit view enable rescan bool b enable bool b old value m bautomaticrescan m bautomaticrescan b enable return b old value cmergeeditview enablerescan benable boldvalue m_bautomaticrescan m_bautomaticrescan benable boldvalue void c merge edit view show diff bool b scroll bool b select text c merge doc pd get document int n diff pd get current diff if n diff 0 n diff int pd m ndiffs c point pt start pt end pt start x 0 pt start y pd m diffs n diff dbegin0 if b scroll int line pt start y context lines if line 0 line 0 scroll to line line set cursor pos pt start set anchor pt start if b select text pt end y pd m diffs n diff dend0 pt end x get line length pt end y set selection pt start pt end update caret else invalidate cmergeeditview showdiff bscroll bselecttext cmergedoc getdocument ndiff getcurrentdiff ndiff ndiff m_ndiffs cpoint ptstart ptend ptstart ptstart m_diffs ndiff bscroll ptstart context_lines scrolltoline setcursorpos ptstart setanchor ptstart bselecttext ptend m_diffs ndiff ptend getlinelength ptend setselection ptstart ptend updatecaret void c merge edit view on edit operation int n action lpctstr psz text c merge doc p doc get document perform original function c crystal edit view ex on edit operation n action psz text augment with additional operations clear left only or right only flags editing in blank areas should be considered c point pt cursor pos get cursor pos m ptextbuffer set line flag pt cursor pos y lf winmerge flags false false false if automatic rescan enabled rescan after edit events if m bautomaticrescan keep document up to date re start timer to rescan only when user edits text if timer starting fails rescan immediately if n action ce action typing n action ce action replace n action ce action backspace n action ce action indent if set timer idt rescan rescan timeout null p doc flush and rescan else p doc flush and rescan cmergeeditview oneditoperation naction psztext cmergedoc pdoc getdocument ccrystaleditviewex oneditoperation naction psztext cpoint ptcursorpos getcursorpos m_ptextbuffer setlineflag ptcursorpos lf_winmerge_flags m_bautomaticrescan naction ce_action_typing naction ce_action_replace naction ce_action_backspace naction ce_action_indent settimer idt_rescan rescan_timeout pdoc flushandrescan pdoc flushandrescan void c merge edit view update line lengths m nmaxlinelength 1 get max line length cmergeeditview updatelinelengths m_nmaxlinelength getmaxlinelength bool c merge edit view is line in current diff int n line c merge doc pd get document int cur pd get current diff if cur 1 return false return n line int pd m diffs cur dbegin0 n line int pd m diffs cur dend0 cmergeeditview islineincurrentdiff nline cmergedoc getdocument getcurrentdiff nline m_diffs nline m_diffs void c merge edit view select none set selection get cursor pos get cursor pos update caret cmergeeditview selectnone setselection getcursorpos getcursorpos updatecaret void c merge edit view select diff int n diff bool b scroll true bool b select text true c merge doc pd get document select none pd set current diff n diff show diff b scroll b select text pd update all views this update sibling scroll pos false cmergeeditview selectdiff ndiff bscroll bselecttext cmergedoc getdocument selectnone setcurrentdiff ndiff showdiff bscroll bselecttext updateallviews updatesiblingscrollpos c crystal text buffer c merge edit view locate text buffer if m bisleft return get document m ltbuf return get document m rtbuf ccrystaltextbuffer cmergeeditview locatetextbuffer m_bisleft getdocument m_ltbuf getdocument m_rtbuf void c merge edit view reset mod cmergeeditview resetmod void c merge edit view add mod cmergeeditview addmod c string c merge edit view get selected text c point pt start pt end c string str text get selection pt start pt end get text pt start pt end str text return str text cstring cmergeeditview getselectedtext cpoint ptstart ptend cstring strtext getselection ptstart ptend gettext ptstart ptend strtext strtext c string c merge edit view get line text int idx return get line chars idx cstring cmergeeditview getlinetext getlinechars void c merge edit view do scroll uint code uint pos bool b do scroll trace t scroll s pos d n m bisleft t left t right pos if b do scroll code sb thumbposition code sb thumbtrack scroll to line pos c crystal edit view ex onv scroll code pos null cmergeeditview doscroll bdoscroll _t m_bisleft _t _t bdoscroll sb_thumbposition sb_thumbtrack scrolltoline ccrystaleditviewex onvscroll void c merge edit view update resources cmergeeditview updateresources bool c merge edit view prime list with file int n resume top line m ntopline set word wrapping false reset view recalc vert scroll bar set tab size mf m ntabsize scroll to line n resume top line return true cmergeeditview primelistwithfile nresumetopline m_ntopline setwordwrapping resetview recalcvertscrollbar settabsize m_ntabsize scrolltoline nresumetopline bool c merge edit view do drop text c ole data object p data object const c point pt client is the drag source in one of win merge panel bool global bdraggingtext false c splitter wnd p splitter wnd get parent splitter this false if p splitter wnd null int n rows p splitter wnd get row count int n cols p splitter wnd get column count for int n row 0 n row n rows n row for int n col 0 n col n cols n col c merge edit view p sibling view static cast c merge edit view get sibling view n row n col if p sibling view null global bdraggingtext p sibling view m bdraggingtext bool ret if global bdraggingtext we drap and drop inside win merge disable rescan for the drop operation it will be done during the drag one rescan suppress suppress rescan get document ret c crystal edit view ex do drop text p data object pt client suppress rescan clear done suppress rescan else ret c crystal edit view ex do drop text p data object pt client return ret cmergeeditview dodroptext coledataobject pdataobject cpoint ptclient winmerge global_bdraggingtext csplitterwnd psplitterwnd getparentsplitter psplitterwnd nrows psplitterwnd getrowcount ncols psplitterwnd getcolumncount nrow nrow nrows nrow ncol ncol ncols ncol cmergeeditview psiblingview static_cast cmergeeditview getsiblingview nrow ncol psiblingview global_bdraggingtext psiblingview m_bdraggingtext global_bdraggingtext winmerge rescansuppress suppressrescan getdocument ccrystaleditviewex dodroptext pdataobject ptclient suppressrescan ccrystaleditviewex dodroptext pdataobject ptclient void c merge edit view on initial update c crystal edit view ex on initial update set font dynamic cast c main frame afx get main wnd m lfdiff cmergeeditview oninitialupdate ccrystaleditviewex oninitialupdate setfont dynamic_cast cmainframe afxgetmainwnd m_lfdiff void c merge edit view on activate view bool b activate c view p activate view c view p deactive view c crystal edit view ex on activate view b activate p activate view p deactive view c merge doc p doc get document p doc update header activity m bisleft b activate cmergeeditview onactivateview bactivate cview pactivateview cview pdeactiveview ccrystaleditviewex onactivateview bactivate pactivateview pdeactiveview cmergedoc pdoc getdocument pdoc updateheaderactivity m_bisleft bactivate void c merge edit view on update c view p sender lparam l hint c object p hint c crystal edit view ex on update p sender l hint p hint show diff false false cmergeeditview onupdate cview psender lhint cobject phint ccrystaleditviewex onupdate psender lhint phint showdiff bool c merge edit view pre translate message msg p msg check if we got esc pressed message if p msg message wm keydown p msg w param vk escape ask about saving unsaved document c merge doc pd get document if pd save helper set modified status to false so that we are not asking about saving again pd m ltbuf set modified false pd m rtbuf set modified false afx get main wnd post message wm command id file close return false else return true return c crystal edit view ex pre translate message p msg cmergeeditview pretranslatemessage pmsg pmsg wm_keydown pmsg wparam vk_escape cmergedoc getdocument savehelper m_ltbuf setmodified m_rtbuf setmodified afxgetmainwnd postmessage wm_command id_file_close ccrystaleditviewex pretranslatemessage pmsg c merge edit view c merge edit view cmergeeditview cmergeeditview colorref cr text bool b draw whitespace dword dw line flags get line flags n line index line inside diff if dw line flags lf winmerge flags black text inside diffs cr text rgb 0 0 0 b draw whitespace true bool line in current diff is line in current diff n line index if dw line flags lf diff if line in current diff cr bkgnd the app get sel diff color else cr bkgnd the app get diff color return else if dw line flags lf deleted if line in current diff cr bkgnd the app get sel diff color else cr bkgnd rgb 192 192 192 return else if dw line flags lf left only if line in current diff cr bkgnd the app get sel diff color else if m bisleft cr bkgnd the app get diff color else cr bkgnd rgb 192 192 192 return else if dw line flags lf right only if line in current diff cr bkgnd the app get sel diff color else if m bisleft cr bkgnd rgb 192 192 192 else cr bkgnd the app get diff color return else if no syntax hilighting if the app m bhilitesyntax cr bkgnd rgb 255 255 255 cr text rgb 0 0 0 b draw whitespace false else line not inside diff get colors from crystal editor c crystal edit view ex get line colors n line index cr bkgnd cr text b draw whitespace crtext bdrawwhitespace dwlineflags getlineflags nlineindex dwlineflags lf_winmerge_flags crtext bdrawwhitespace lineincurrentdiff islineincurrentdiff nlineindex dwlineflags lf_diff lineincurrentdiff crbkgnd theapp getseldiffcolor crbkgnd theapp getdiffcolor dwlineflags lf_deleted lineincurrentdiff crbkgnd theapp getseldiffcolor crbkgnd dwlineflags lf_left_only lineincurrentdiff crbkgnd theapp getseldiffcolor m_bisleft crbkgnd theapp getdiffcolor crbkgnd dwlineflags lf_right_only lineincurrentdiff crbkgnd theapp getseldiffcolor m_bisleft crbkgnd crbkgnd theapp getdiffcolor theapp m_bhilitesyntax crbkgnd crtext bdrawwhitespace crystaleditor ccrystaleditviewex getlinecolors nlineindex crbkgnd crtext bdrawwhitespace void c merge edit view update sibling scroll pos bool b horz c splitter wnd p splitter wnd get parent splitter this false if p splitter wnd null see c splitter wnd id from row col implementation for details int n current row get dlg ctrlid afx idw pane first 16 int n current col get dlg ctrlid afx idw pane first 16 assert n current row 0 n current row p splitter wnd get row count assert n current col 0 n current col p splitter wnd get column count limit the top line must be smaller than get line count for all the panels int new top line m ntopline int n rows p splitter wnd get row count int n cols p splitter wnd get column count for int n row 0 n row n rows n row for int n col 0 n col n cols n col c merge edit view p sibling view static cast c merge edit view get sibling view n row n col if p sibling view null if p sibling view get line count new top line new top line p sibling view get line count 1 if m ntopline new top line scroll to line new top line for n row 0 n row n rows n row for int n col 0 n col n cols n col if n row n current row n col n current col we don t need to update ourselves c merge edit view p sibling view static cast c merge edit view get sibling view n row n col if p sibling view null p sibling view on update sibling this b horz cmergeeditview updatesiblingscrollpos bhorz csplitterwnd psplitterwnd getparentsplitter psplitterwnd csplitterwnd idfromrowcol ncurrentrow getdlgctrlid afx_idw_pane_first ncurrentcol getdlgctrlid afx_idw_pane_first ncurrentrow ncurrentrow psplitterwnd getrowcount ncurrentcol ncurrentcol psplitterwnd getcolumncount topline getlinecount newtopline m_ntopline nrows psplitterwnd getrowcount ncols psplitterwnd getcolumncount nrow nrow nrows nrow ncol ncol ncols ncol cmergeeditview psiblingview static_cast cmergeeditview getsiblingview nrow ncol psiblingview psiblingview getlinecount newtopline newtopline psiblingview getlinecount m_ntopline newtopline scrolltoline newtopline nrow nrow nrows nrow ncol ncol ncols ncol nrow ncurrentrow ncol ncurrentcol cmergeeditview psiblingview static_cast cmergeeditview getsiblingview nrow ncol psiblingview psiblingview onupdatesibling bhorz void c merge edit view on curdiff c merge doc pd get document if pd m ndiffs 0 get the diff location int n diff pd get current diff if n diff 1 scroll to the first line of the first diff with some context thrown in select diff n diff true false else c point pos get cursor pos n diff pd line to diff pos y if n diff 1 select diff n diff true false cmergeeditview oncurdiff cmergedoc getdocument m_ndiffs ndiff getcurrentdiff ndiff selectdiff ndiff cpoint getcursorpos ndiff linetodiff ndiff selectdiff ndiff void c merge edit view on update curdiff c cmdui p cmdui c merge doc pd get document c point pos get cursor pos int n current diff pd get current diff if n current diff 1 if pd line to diff pos y 1 p cmdui enable false else p cmdui enable true else p cmdui enable true cmergeeditview onupdatecurdiff ccmdui pcmdui cmergedoc getdocument cpoint getcursorpos ncurrentdiff getcurrentdiff ncurrentdiff linetodiff pcmdui pcmdui pcmdui void c merge edit view on edit copy c merge doc p doc get document c point pt sel start pt sel end get selection pt sel start pt sel end nothing selected if pt sel start pt sel end return c string text c merge doc c diff text buffer buffer m bisleft p doc m ltbuf p doc m rtbuf buffer get text without emptys pt sel start y pt sel start x pt sel end y pt sel end x text m bisleft put to clipboard text cmergeeditview oneditcopy cmergedoc pdoc getdocument cpoint ptselstart ptselend getselection ptselstart ptselend ptselstart ptselend cstring cmergedoc cdifftextbuffer m_bisleft pdoc m_ltbuf pdoc m_rtbuf gettextwithoutemptys ptselstart ptselstart ptselend ptselend m_bisleft puttoclipboard void c merge edit view on update edit copy c cmdui p cmdui c crystal edit view ex on update edit copy p cmdui cmergeeditview onupdateeditcopy ccmdui pcmdui ccrystaleditviewex onupdateeditcopy pcmdui void c merge edit view on edit cut c point pt sel start pt sel end c merge doc p doc get document get selection pt sel start pt sel end if pt sel start pt sel end return c string text if m bisleft p doc m ltbuf get text without emptys pt sel start y pt sel start x pt sel end y pt sel end x text m bisleft else p doc m rtbuf get text without emptys pt sel start y pt sel start x pt sel end y pt sel end x text m bisleft put to clipboard text c point pt cursor pos pt sel start assert validtextpos pt cursor pos set anchor pt cursor pos set selection pt cursor pos pt cursor pos set cursor pos pt cursor pos ensure visible pt cursor pos if m bisleft p doc m ltbuf delete text this pt sel start y pt sel start x pt sel end y pt sel end x ce action cut else p doc m rtbuf delete text this pt sel start y pt sel start x pt sel end y pt sel end x ce action cut m ptextbuffer set modified true cmergeeditview oneditcut cpoint ptselstart ptselend cmergedoc pdoc getdocument getselection ptselstart ptselend ptselstart ptselend cstring m_bisleft pdoc m_ltbuf gettextwithoutemptys ptselstart ptselstart ptselend ptselend m_bisleft pdoc m_rtbuf gettextwithoutemptys ptselstart ptselstart ptselend ptselend m_bisleft puttoclipboard cpoint ptcursorpos ptselstart assert_validtextpos ptcursorpos setanchor ptcursorpos setselection ptcursorpos ptcursorpos setcursorpos ptcursorpos ensurevisible ptcursorpos m_bisleft pdoc m_ltbuf deletetext ptselstart ptselstart ptselend ptselend ce_action_cut pdoc m_rtbuf deletetext ptselstart ptselstart ptselend ptselend ce_action_cut m_ptextbuffer setmodified void c merge edit view on update edit cut c cmdui p cmdui c crystal edit view ex on update edit cut p cmdui cmergeeditview onupdateeditcut ccmdui pcmdui ccrystaleditviewex onupdateeditcut pcmdui void c merge edit view on edit paste c crystal edit view ex paste m ptextbuffer set modified true cmergeeditview oneditpaste ccrystaleditviewex m_ptextbuffer setmodified void c merge edit view on update edit paste c cmdui p cmdui c crystal edit view ex on update edit paste p cmdui cmergeeditview onupdateeditpaste ccmdui pcmdui ccrystaleditviewex onupdateeditpaste pcmdui void c merge edit view on edit undo c merge doc p doc get document c merge edit view tgt p doc cur undo 1 if tgt this get parent frame set active view this true if c crystal edit view ex do edit undo p doc cur undo p doc flush and rescan else tgt send message wm command id edit undo cmergeeditview oneditundo cmergedoc pdoc getdocument cmergeeditview pdoc curundo getparentframe setactiveview ccrystaleditviewex doeditundo pdoc curundo pdoc flushandrescan sendmessage wm_command id_edit_undo void c merge edit view on firstdiff c merge doc pd get document if pd m ndiffs 0 scroll to the first line of the first diff with some context thrown in int line pd m diffs 0 dbegin0 context lines if line 0 line 0 scroll to line line update sibling scroll pos false select the diff select diff 0 true false cmergeeditview onfirstdiff cmergedoc getdocument m_ndiffs m_diffs context_lines scrolltoline updatesiblingscrollpos selectdiff void c merge edit view on update firstdiff c cmdui p cmdui on update prevdiff p cmdui cmergeeditview onupdatefirstdiff ccmdui pcmdui onupdateprevdiff pcmdui void c merge edit view on lastdiff c merge doc pd get document if pd m ndiffs 0 select diff pd m ndiffs 1 true false cmergeeditview onlastdiff cmergedoc getdocument m_ndiffs selectdiff m_ndiffs void c merge edit view on update lastdiff c cmdui p cmdui on update nextdiff p cmdui cmergeeditview onupdatelastdiff ccmdui pcmdui onupdatenextdiff pcmdui void c merge edit view on nextdiff c merge doc pd get document int cnt pd m ltbuf get line count if cnt 0 return returns 1 if no diff selected int cur diff pd get current diff if cur diff 1 if cur diff pd m ndiffs 1 we re on a last diff so select that select diff cur diff true false else we re on a diff so select the next one select diff cur diff 1 true false else we re not on a diff so figure out which one to select int line get cursor pos y if is valid text posy c point 0 line line m ntopline for uint i 0 i pd m ndiffs i if int pd m diffs i dbegin0 line cur diff i break select diff cur diff true false cmergeeditview onnextdiff cmergedoc getdocument m_ltbuf getlinecount curdiff getcurrentdiff curdiff curdiff m_ndiffs selectdiff curdiff selectdiff curdiff getcursorpos isvalidtextposy cpoint m_ntopline m_ndiffs m_diffs curdiff selectdiff curdiff void c merge edit view on update nextdiff c cmdui p cmdui c merge doc pd get document c point pos get cursor pos p cmdui enable pd m ndiffs 0 pos y long pd m diffs pd m ndiffs 1 dbegin0 cmergeeditview onupdatenextdiff ccmdui pcmdui cmergedoc getdocument cpoint getcursorpos pcmdui m_ndiffs m_diffs m_ndiffs void c merge edit view on prevdiff c merge doc pd get document int cnt pd m ltbuf get line count if cnt 0 return returns 1 if no diff selected int cur diff pd get current diff if cur diff 1 if cur diff 0 we re on a first diff select it select diff cur diff true false else we re on a diff so select the previous one select diff cur diff 1 true false else we re not on a diff so figure out which one to select int line get cursor pos y if is valid text posy c point 0 line line m ntopline for int i pd m ndiffs 1 i 0 i if int pd m diffs i dend0 line cur diff i break select diff cur diff true false cmergeeditview onprevdiff cmergedoc getdocument m_ltbuf getlinecount curdiff getcurrentdiff curdiff curdiff selectdiff curdiff selectdiff curdiff getcursorpos isvalidtextposy cpoint m_ntopline m_ndiffs m_diffs curdiff selectdiff curdiff void c merge edit view on update prevdiff c cmdui p cmdui c merge doc pd get document c point pos get cursor pos p cmdui enable pd m ndiffs 0 pos y long pd m diffs 0 dend0 cmergeeditview onupdateprevdiff ccmdui pcmdui cmergedoc getdocument cpoint getcursorpos pcmdui m_ndiffs m_diffs void c merge edit view onl button dbl clk uint n flags c point point c merge doc pd get document c point pos get cursor pos int diff pd line to diff pos y if diff 1 select diff diff false false mf m pleft invalidate mf m pright invalidate c crystal edit view ex onl button dbl clk n flags point cmergeeditview onlbuttondblclk nflags cpoint cmergedoc getdocument cpoint getcursorpos linetodiff selectdiff m_pleft m_pright ccrystaleditviewex onlbuttondblclk nflags void c merge edit view onl button up uint n flags c point point c merge doc pd get document c crystal edit view ex onl button up n flags point c point pos get cursor pos if is line in current diff pos y pd set current diff 1 invalidate pd update all views this cmergeeditview onlbuttonup nflags cpoint cmergedoc getdocument ccrystaleditviewex onlbuttonup nflags cpoint getcursorpos islineincurrentdiff setcurrentdiff updateallviews void c merge edit view on all left wait status cursor waitstatus load res string ids status copyall2l get document copy all list false cmergeeditview onallleft waitstatuscursor loadresstring ids_status_copyall2l getdocument copyalllist void c merge edit view on update all left c cmdui p cmdui p cmdui enable get document m ndiffs 0 cmergeeditview onupdateallleft ccmdui pcmdui pcmdui getdocument m_ndiffs void c merge edit view on all right wait status cursor waitstatus load res string ids status copyall2r get document copy all list true cmergeeditview onallright waitstatuscursor loadresstring ids_status_copyall2r getdocument copyalllist void c merge edit view on update all right c cmdui p cmdui p cmdui enable get document m ndiffs 0 cmergeeditview onupdateallright ccmdui pcmdui pcmdui getdocument m_ndiffs void c merge edit view onl2r wait status cursor waitstatus load res string ids status copyl2r get document list copy true cmergeeditview waitstatuscursor loadresstring ids_status_copyl2r getdocument listcopy void c merge edit view on updatel2r c cmdui p cmdui p cmdui enable get document get current diff 1 cmergeeditview onupdatel2r ccmdui pcmdui pcmdui getdocument getcurrentdiff void c merge edit view onr2l wait status cursor waitstatus load res string ids status copyr2l get document list copy false cmergeeditview waitstatuscursor loadresstring ids_status_copyr2l getdocument listcopy void c merge edit view on updater2l c cmdui p cmdui p cmdui enable get document get current diff 1 cmergeeditview onupdater2l ccmdui pcmdui pcmdui getdocument getcurrentdiff void c merge edit view on update edit undo c cmdui p cmdui c merge doc p doc get document p cmdui enable p doc cur undo p doc undo tgt begin cmergeeditview onupdateeditundo ccmdui pcmdui cmergedoc pdoc getdocument pcmdui pdoc curundo pdoc undotgt void c merge edit view on edit redo c merge doc p doc get document c merge edit view tgt p doc cur undo if tgt this get parent frame set active view this true if c crystal edit view ex do edit redo p doc cur undo p doc flush and rescan else tgt send message wm command id edit redo cmergeeditview oneditredo cmergedoc pdoc getdocument cmergeeditview pdoc curundo getparentframe setactiveview ccrystaleditviewex doeditredo pdoc curundo pdoc flushandrescan sendmessage wm_command id_edit_redo void c merge edit view on update edit redo c cmdui p cmdui c merge doc p doc get document p cmdui enable p doc cur undo p doc undo tgt end cmergeeditview onupdateeditredo ccmdui pcmdui cmergedoc pdoc getdocument pcmdui pdoc curundo pdoc undotgt void c merge edit view on timer uint nid event we get two kinds of timers idt rescan means it has been a while since the user last made a change so we d like to do a rescan as soon as feasible idle timer means the application is idling so now it is feasible to rescan if we get the idle timer we pass the buck to the document ie it may still skip the rescan if it just did one recently if nid event idt rescan kill timer idt rescan get document set need rescan the app set need idle timer else if nid event idle timer get document rescan if needed c crystal edit view ex on timer nid event cmergeeditview ontimer nidevent idt_rescan idle_timer nidevent idt_rescan killtimer idt_rescan getdocument setneedrescan theapp setneedidletimer nidevent idle_timer getdocument rescanifneeded ccrystaleditviewex ontimer nidevent void c merge edit view on refresh c merge doc pd get document assert pd pd flush and rescan true cmergeeditview onrefresh cmergedoc getdocument flushandrescan void c merge edit view on update file save c cmdui p cmdui c merge doc pd get document if pd m ltbuf is modified pd m rtbuf is modified p cmdui enable true else p cmdui enable false cmergeeditview onupdatefilesave ccmdui pcmdui cmergedoc getdocument m_ltbuf ismodified m_rtbuf ismodified pcmdui pcmdui public bc menu data menu icon normal 1 xoffset 1 bitmap null p context null bcmenudata menuiconnormal pcontext public bc menu data menu icon normal 1 xoffset 1 bitmap null p context null bcmenudata menuiconnormal pcontext void bc menu data set ansi string lpcstr sz ansi string uses conversion set wide string a2w sz ansi string sk see mfc tech note 059 bcmenudata setansistring szansistring uses_conversion setwidestring szansistring void bc menu data set wide string const wchar t sz wide string delete m szmenutext need not check for null because ansi x3j16 allows delete null if sz wide string m szmenutext new wchar t sizeof wchar t wcslen sz wide string 1 if m szmenutext wcscpy m szmenutext sz wide string else m szmenutext null set to null so we need not bother about dangling non null ptrs bcmenudata setwidestring wchar_t szwidestring m_szmenutext szwidestring m_szmenutext wchar_t wchar_t szwidestring m_szmenutext m_szmenutext szwidestring m_szmenutext bc menu data bc menu data if bitmap delete bitmap delete m szmenutext need not check for null because ansi x3j16 allows delete null bcmenudata bcmenudata m_szmenutext depending on the mfc version we are using c string str text if m szmenutext ifdef unicode str text m szmenutext else uses conversion str text w2a m szmenutext sk see mfc tech note 059 endif return str text cstring strtext m_szmenutext strtext m_szmenutext uses_conversion strtext m_szmenutext strtext function to set how menu is drawn either original or xp style static void set menu draw mode uint mode bc menu original drawmode mode bc menu xp drawmode mode setmenudrawmode bcmenu original_drawmode bcmenu xp_drawmode function to set how disabled items are drawn mode false means they are not drawn selected static void set select disable mode bool mode bc menu original select disabled mode bc menu xp select disabled mode setselectdisablemode bcmenu original_select_disabled bcmenu xp_select_disabled how the bitmaps are drawn in xp luna mode static void setxp bitmap3d bool val bc menu xp draw 3d bitmaps val setxpbitmap3d bcmenu xp_draw_3d_bitmaps bc menu bc menu m bdynicons false o s no dynamic icons by default disable old style false m selectcheck 1 m unselectcheck 1 checkmaps null checkmapsshare false set the color used for the transparent background in all bitmaps m bitmapbackground rgb 192 192 192 gray m bitmapbackgroundflag false getcp info cp acp cp info m loadmenu false bcmenu bcmenu m_bdynicons disable_old_style m_selectcheck m_unselectcheck m_bitmapbackground m_bitmapbackgroundflag getcpinfo cp_acp cpinfo m_loadmenu bc menu bc menu destroy menu bcmenu bcmenu destroymenu bool bc menu load menu lpctstr lpsz resource name assert valid this assert lpsz resource name null find the menu resource hinstance h inst afx find resource handle lpsz resource name rt menu hrsrc h rsrc find resource h inst lpsz resource name rt menu if h rsrc null h inst null h rsrc find resource h inst lpsz resource name rt menu if h rsrc null return false load the menu resource hglobal h global load resource h inst h rsrc if h global null return false first destroy the menu if we re trying to loadmenu again destroy menu attempt to create us as a menu if c menu create menu return false get item template header and calculate offset of menuitemtemplates menuitemtemplateheader p tp hdr menuitemtemplateheader lock resource h global byte p tp byte p tp hdr sizeof menuitemtemplateheader p tp hdr offset variables needed during processing of menu item templates int j 0 word dw flags 0 flags of the menu item word dwid 0 id of the menu item uint u flags actual flags wchar t sz caption null int n len 0 length of caption c typed ptr array c ptr array bc menu m stack popup menu stack c array bool bool m stackend popup menu stack m stack add this add it to this m stackend add false do obtain flags and if necessary the id memcpy dw flags p tp sizeof word p tp sizeof word obtain flags if dw flags mf popup memcpy dwid p tp sizeof word obtain id p tp sizeof word else dwid 0 u flags uint dw flags remove mf end from the flags that will if u flags mf end be passed to the append od menu functions u flags mf end obtain caption and length n len 0 sz caption new wchar t wcslen wchar t p tp 1 wcscpy sz caption wchar t p tp p tp p tp wcslen wchar t p tp 1 sizeof wchar t modified sk handle popup menus first wide char to multi byte if dw flags mf popup if dw flags mf end m stackend set at m stack get upper bound true bc menu p sub menu new bc menu p sub menu m unselectcheck m unselectcheck p sub menu m selectcheck m selectcheck p sub menu checkmaps checkmaps p sub menu checkmapsshare true p sub menu create popup menu append it to the top of the stack m stack m stack get upper bound appendod menuw sz caption u flags uint p sub menu m hmenu 1 m stack add p sub menu m stackend add false else m stack m stack get upper bound appendod menuw sz caption u flags dwid 1 if dw flags mf end m stackend set at m stack get upper bound true j m stack get upper bound while j 0 m stackend get at j m stack m stack get upper bound insert spaces m stack remove at j m stackend remove at j j delete sz caption while m stack get upper bound 1 for int i 0 i int get menu item count i c string str m menulist i get string if get sub menu i m menulist i n flags mf popup mf byposition modify menu i mf popup mf byposition uint get sub menu i m hmenu str else m menulist i n flags mf string mf byposition modify menu i mf string mf byposition m menulist i nid str m loadmenu true return true bcmenu loadmenu lpszresourcename assert_valid lpszresourcename hinst afxfindresourcehandle lpszresourcename rt_menu hrsrc findresource hinst lpszresourcename rt_menu hrsrc hinst hrsrc findresource hinst lpszresourcename rt_menu hrsrc hglobal loadresource hinst hrsrc hglobal destroymenu cmenu createmenu ptphdr lockresource hglobal ptp ptphdr ptphdr dwflags uflags wchar_t szcaption nlen ctypedptrarray cptrarray bcmenu m_stack carray m_stackend m_stack m_stackend dwflags ptp ptp dwflags mf_popup ptp ptp uflags dwflags mf_end uflags mf_end uflags mf_end nlen szcaption wchar_t wchar_t ptp szcaption wchar_t ptp ptp ptp wchar_t ptp wchar_t widechartomultibyte dwflags mf_popup dwflags mf_end m_stackend setat m_stack getupperbound bcmenu psubmenu bcmenu psubmenu m_unselectcheck m_unselectcheck psubmenu m_selectcheck m_selectcheck psubmenu psubmenu psubmenu createpopupmenu m_stack m_stack getupperbound appendodmenuw szcaption uflags psubmenu m_hmenu m_stack psubmenu m_stackend m_stack m_stack getupperbound appendodmenuw szcaption uflags dwflags mf_end m_stackend setat m_stack getupperbound m_stack getupperbound m_stackend getat m_stack m_stack getupperbound insertspaces m_stack removeat m_stackend removeat szcaption m_stack getupperbound getmenuitemcount cstring m_menulist getstring getsubmenu m_menulist nflags mf_popup mf_byposition modifymenu mf_popup mf_byposition getsubmenu m_hmenu m_menulist nflags mf_string mf_byposition modifymenu mf_string mf_byposition m_menulist m_loadmenu bool bc menu load menu int n resource return bc menu load menu makeintresource n resource bcmenu loadmenu nresource bcmenu loadmenu nresource bool bc menu load toolbar uint n tool bar uint nid n style bool returnflag false c tool bar bar int xoffset 1 xset c wnd p wnd afx get main wnd if p wnd null p wnd c wnd get desktop window bar create p wnd if bar load tool bar n tool bar c image list imglist imglist create m iconx m icony ilc colorddb ilc mask 1 1 if add bitmap to image list imglist n tool bar returnflag true for int i 0 i bar get count i nid bar get itemid i if nid get menu state nid mf bycommand 0xffffffff xoffset bar command to index nid if xoffset 0 bar get button info xoffset nid n style xset if xset 0 xoffset xset modifyod menu null nid imglist xoffset return returnflag bcmenu loadtoolbar ntoolbar nstyle ctoolbar cwnd pwnd afxgetmainwnd pwnd pwnd cwnd getdesktopwindow pwnd loadtoolbar ntoolbar cimagelist m_iconx m_icony ilc_colorddb ilc_mask addbitmaptoimagelist ntoolbar getcount getitemid getmenustate mf_bycommand commandtoindex getbuttoninfo nstyle modifyodmenu bool bc menu load toolbars const uint arid int n assert arid bool returnflag true for int i 0 i n i if load toolbar arid i returnflag false return returnflag bcmenu loadtoolbars loadtoolbar void bc menu add from tool bar c tool bar p tool bar int n resourceid for int i 0 i p tool bar get count i uint nid p tool bar get itemid i see if this toolbar option appears as a command on this menu or is a separator if nid 0 get menu state nid mf bycommand 0xffffffff continue item doesn t exist uint n style int n image get the toolbar button info p tool bar get button info i nid n style n image ok we have the command id of the toolbar option and the tollbar bitmap offset int n loc bc menu data p data bc menu p sub menu find menu option nid n loc if p sub menu n loc 0 p data p sub menu m menulist n loc else create a new bc menu data structure p data new bc menu data m menulist add p data set some default structure members p data menu icon normal n resourceid p data nid nid p data n flags mf bycommand mf ownerdraw p data xoffset n image if p data bitmap p data bitmap delete image list else p data bitmap new c image list p data bitmap create m iconx m icony ilc colorddb ilc mask 1 1 if add bitmap to image list p data bitmap n resourceid p data bitmap delete image list delete p data bitmap p data bitmap null p data menu icon normal 1 p data xoffset 1 modify our menu modify menu nid p data n flags nid lpctstr p data bcmenu addfromtoolbar ctoolbar ptoolbar nresourceid ptoolbar getcount ptoolbar getitemid getmenustate mf_bycommand nstyle nimage ptoolbar getbuttoninfo nstyle nimage nloc bcmenudata pdata bcmenu psubmenu findmenuoption nloc psubmenu nloc pdata psubmenu m_menulist nloc bcmenudata pdata bcmenudata m_menulist pdata pdata menuiconnormal nresourceid pdata pdata nflags mf_bycommand mf_ownerdraw pdata nimage pdata pdata deleteimagelist pdata cimagelist pdata m_iconx m_icony ilc_colorddb ilc_mask addbitmaptoimagelist pdata nresourceid pdata deleteimagelist pdata pdata pdata menuiconnormal pdata modifymenu pdata nflags pdata bool bc menu load from tool bar uint nid uint n tool bar int xoffset int xset offset uint n style bool returnflag false c tool bar bar c wnd p wnd afx get main wnd if p wnd null p wnd c wnd get desktop window bar create p wnd if bar load tool bar n tool bar offset bar command to index nid if offset 0 bar get button info offset nid n style xset if xset 0 xoffset xset returnflag true return returnflag bcmenu loadfromtoolbar ntoolbar nstyle ctoolbar cwnd pwnd afxgetmainwnd pwnd pwnd cwnd getdesktopwindow pwnd loadtoolbar ntoolbar commandtoindex getbuttoninfo nstyle bool bc menu add bitmap to image list c image list bmplist uint n resourceid bool b return false o s if m bdynicons bmplist add hicon n resourceid b return true else hbitmap hbmp load sys color bitmap n resourceid if hbmp c bitmap bmp bmp attach hbmp if m bitmapbackgroundflag if bmplist add bmp m bitmapbackground 0 b return true else if bmplist add bmp get sys color color 3dface 0 b return true bmp detach delete object hbmp else a hicolor bitmap c bitmap mybmp if mybmp load bitmap n resourceid hicolor bitmaps true get transparent bitmap mybmp if m bitmapbackgroundflag if bmplist add mybmp m bitmapbackground 0 b return true else if bmplist add mybmp get sys color color 3dface 0 b return true if b return is luna menu style xp draw 3d bitmaps c wnd p wnd afx get main wnd get main window if p wnd null p wnd c wnd get desktop window cdc pdc p wnd getdc get device context c bitmap bmp bmp2 bmp3 get bitmap from image list pdc bmplist 0 bmp get faded bitmap bmp bmplist add bmp get sys color color 3dface get bitmap from image list pdc bmplist 0 bmp2 get shadow bitmap bmp2 bmplist add bmp2 get sys color color 3dface get bitmap from image list pdc bmplist 0 bmp3 get disabled bitmap bmp3 bmplist add bmp3 get sys color color 3dface p wnd releasedc pdc release the dc return b return bcmenu addbitmaptoimagelist cimagelist nresourceid breturn m_bdynicons nresourceid breturn loadsyscolorbitmap nresourceid cbitmap m_bitmapbackgroundflag m_bitmapbackground breturn getsyscolor color_3dface breturn deleteobject cbitmap loadbitmap nresourceid hicolor_bitmaps gettransparentbitmap m_bitmapbackgroundflag m_bitmapbackground breturn getsyscolor color_3dface breturn breturn islunamenustyle xp_draw_3d_bitmaps cwnd pwnd afxgetmainwnd pwnd pwnd cwnd getdesktopwindow pwnd cbitmap getbitmapfromimagelist getfadedbitmap getsyscolor color_3dface getbitmapfromimagelist getshadowbitmap getsyscolor color_3dface getbitmapfromimagelist getdisabledbitmap getsyscolor color_3dface pwnd breturn hbitmap bc menu load sys color bitmap int n resource id hinstance h inst afx find resource handle makeintresource n resource id rt bitmap hrsrc h rsrc find resource h inst makeintresource n resource id rt bitmap if h rsrc null h inst null h rsrc find resource h inst makeintresource n resource id rt bitmap if h rsrc null return null determine how many colors in the bitmap hglobal hglb if hglb load resource h inst h rsrc null return null lpbitmapinfoheader lp bitmap lpbitmapinfoheader lock resource hglb if lp bitmap null return null word numcol num bitmap colors lp bitmap free resource hglb if numcol 16 return null return afx load sys color bitmap h inst h rsrc false bcmenu loadsyscolorbitmap nresourceid hinst afxfindresourcehandle nresourceid rt_bitmap hrsrc findresource hinst nresourceid rt_bitmap hrsrc hinst hrsrc findresource hinst nresourceid rt_bitmap hrsrc loadresource hinst hrsrc lpbitmap lockresource lpbitmap numbitmapcolors lpbitmap freeresource afxloadsyscolorbitmap hinst hrsrc void bc menu load checkmark bitmap int unselect int select if unselect 0 select 0 m selectcheck select m unselectcheck unselect if checkmaps checkmaps delete image list else checkmaps new c image list checkmaps create m iconx m icony ilc mask 2 1 bool flag1 add bitmap to image list checkmaps unselect bool flag2 add bitmap to image list checkmaps select if flag1 flag2 checkmaps delete image list delete checkmaps checkmaps null bcmenu loadcheckmarkbitmap m_selectcheck m_unselectcheck deleteimagelist cimagelist m_iconx m_icony ilc_mask addbitmaptoimagelist addbitmaptoimagelist deleteimagelist bool bc menu append menua uint n flags uint nid new item const char lpsz new item int n icon normal uses conversion return append menuw n flags nid new item a2w lpsz new item n icon normal bcmenu appendmenua nflags nidnewitem lpsznewitem niconnormal uses_conversion appendmenuw nflags nidnewitem lpsznewitem niconnormal bool bc menu append menua uint n flags uint nid new item const char lpsz new item c image list il int xoffset uses conversion return append menuw n flags nid new item a2w lpsz new item il xoffset bcmenu appendmenua nflags nidnewitem lpsznewitem cimagelist uses_conversion appendmenuw nflags nidnewitem lpsznewitem bool bc menu append menua uint n flags uint nid new item const char lpsz new item c bitmap bmp uses conversion return append menuw n flags nid new item a2w lpsz new item bmp bcmenu appendmenua nflags nidnewitem lpsznewitem cbitmap uses_conversion appendmenuw nflags nidnewitem lpsznewitem bool bc menu append menuw uint n flags uint nid new item wchar t lpsz new item int n icon normal return appendod menuw lpsz new item n flags nid new item n icon normal bcmenu appendmenuw nflags nidnewitem wchar_t lpsznewitem niconnormal appendodmenuw lpsznewitem nflags nidnewitem niconnormal bool bc menu append menuw uint n flags uint nid new item wchar t lpsz new item c image list il int xoffset return appendod menuw lpsz new item n flags nid new item il xoffset bcmenu appendmenuw nflags nidnewitem wchar_t lpsznewitem cimagelist appendodmenuw lpsznewitem nflags nidnewitem bool bc menu append menuw uint n flags uint nid new item wchar t lpsz new item c bitmap bmp if bmp c image list temp temp create m iconx m icony ilc colorddb ilc mask 1 1 if m bitmapbackgroundflag temp add bmp m bitmapbackground else temp add bmp get sys color color 3dface return appendod menuw lpsz new item n flags nid new item temp 0 return appendod menuw lpsz new item n flags nid new item null 0 bcmenu appendmenuw nflags nidnewitem wchar_t lpsznewitem cbitmap cimagelist m_iconx m_icony ilc_colorddb ilc_mask m_bitmapbackgroundflag m_bitmapbackground getsyscolor color_3dface appendodmenuw lpsznewitem nflags nidnewitem appendodmenuw lpsznewitem nflags nidnewitem int n icon normal uses conversion return appendod menuw a2w lpstr text n flags nid n icon normal sk see mfc tech note 059 niconnormal uses_conversion appendodmenuw lpstrtext nflags niconnormal int n icon normal add the mf ownerdraw flag if not specified if nid if n flags mf byposition n flags mf separator mf ownerdraw mf byposition else n flags mf separator mf ownerdraw else if n flags mf ownerdraw n flags mf ownerdraw if n flags mf popup m allsubmenus add hmenu nid m submenus add hmenu nid bc menu data mdata new bc menu data m menulist add mdata mdata set wide string lpstr text sk modified for dynamic allocation mdata menu icon normal 1 mdata xoffset 1 if n icon normal 0 c image list bitmap int xoffset 0 load from tool bar nid n icon normal xoffset if mdata bitmap mdata bitmap delete image list mdata bitmap null bitmap create m iconx m icony ilc colorddb ilc mask 1 1 if add bitmap to image list bitmap n icon normal mdata global offset add to global image list bitmap xoffset nid else mdata global offset global image list offset nid mdata n flags n flags mdata nid nid bool returnflag c menu append menu n flags nid lpctstr mdata if m loadmenu remove top level owner draw return returnflag niconnormal mf_ownerdraw nflags mf_byposition nflags mf_separator mf_ownerdraw mf_byposition nflags mf_separator mf_ownerdraw nflags mf_ownerdraw nflags mf_ownerdraw nflags mf_popup m_allsubmenus m_submenus bcmenudata bcmenudata m_menulist setwidestring lpstrtext menuiconnormal niconnormal cimagelist loadfromtoolbar niconnormal deleteimagelist m_iconx m_icony ilc_colorddb ilc_mask addbitmaptoimagelist niconnormal global_offset addtoglobalimagelist global_offset globalimagelistoffset nflags nflags cmenu appendmenu nflags m_loadmenu removetoplevelownerdraw c image list il int xoffset uses conversion return appendod menuw a2w lpstr text n flags nid il xoffset cimagelist uses_conversion appendodmenuw lpstrtext nflags c image list il int xoffset add the mf ownerdraw flag if not specified if nid if n flags mf byposition n flags mf separator mf ownerdraw mf byposition else n flags mf separator mf ownerdraw else if n flags mf ownerdraw n flags mf ownerdraw if n flags mf popup m allsubmenus add hmenu nid m submenus add hmenu nid bc menu data mdata new bc menu data m menulist add mdata mdata set wide string lpstr text sk modified for dynamic allocation if il mdata menu icon normal 0 mdata xoffset 0 if mdata bitmap mdata bitmap delete image list else mdata bitmap new c image list image list duplicate il xoffset mdata bitmap else mdata menu icon normal 1 mdata xoffset 1 mdata n flags n flags mdata nid nid return c menu append menu n flags nid lpctstr mdata cimagelist mf_ownerdraw nflags mf_byposition nflags mf_separator mf_ownerdraw mf_byposition nflags mf_separator mf_ownerdraw nflags mf_ownerdraw nflags mf_ownerdraw nflags mf_popup m_allsubmenus m_submenus bcmenudata bcmenudata m_menulist setwidestring lpstrtext menuiconnormal deleteimagelist cimagelist imagelistduplicate menuiconnormal nflags nflags cmenu appendmenu nflags bc menu bc menu appendod popup menua lpcstr lpstr text uses conversion return appendod popup menuw a2w lpstr text bcmenu bcmenu appendodpopupmenua lpstrtext uses_conversion appendodpopupmenuw lpstrtext bc menu bc menu appendod popup menuw wchar t lpstr text bc menu p sub menu new bc menu p sub menu m unselectcheck m unselectcheck p sub menu m selectcheck m selectcheck p sub menu checkmaps checkmaps p sub menu checkmapsshare true p sub menu create popup menu appendod menuw lpstr text mf popup uint p sub menu m hmenu 1 return p sub menu bcmenu bcmenu appendodpopupmenuw wchar_t lpstrtext bcmenu psubmenu bcmenu psubmenu m_unselectcheck m_unselectcheck psubmenu m_selectcheck m_selectcheck psubmenu psubmenu psubmenu createpopupmenu appendodmenuw lpstrtext mf_popup psubmenu m_hmenu psubmenu bool bc menu insert menua uint n position uint n flags uint nid new item const char lpsz new item int n icon normal uses conversion return insert menuw n position n flags nid new item a2w lpsz new item n icon normal bcmenu insertmenua nposition nflags nidnewitem lpsznewitem niconnormal uses_conversion insertmenuw nposition nflags nidnewitem lpsznewitem niconnormal bool bc menu insert menua uint n position uint n flags uint nid new item const char lpsz new item c image list il int xoffset uses conversion return insert menuw n position n flags nid new item a2w lpsz new item il xoffset bcmenu insertmenua nposition nflags nidnewitem lpsznewitem cimagelist uses_conversion insertmenuw nposition nflags nidnewitem lpsznewitem bool bc menu insert menua uint n position uint n flags uint nid new item const char lpsz new item c bitmap bmp uses conversion return insert menuw n position n flags nid new item a2w lpsz new item bmp bcmenu insertmenua nposition nflags nidnewitem lpsznewitem cbitmap uses_conversion insertmenuw nposition nflags nidnewitem lpsznewitem bool bc menu insert menuw uint n position uint n flags uint nid new item wchar t lpsz new item int n icon normal return insertod menuw n position lpsz new item n flags nid new item n icon normal bcmenu insertmenuw nposition nflags nidnewitem wchar_t lpsznewitem niconnormal insertodmenuw nposition lpsznewitem nflags nidnewitem niconnormal bool bc menu insert menuw uint n position uint n flags uint nid new item wchar t lpsz new item c image list il int xoffset return insertod menuw n position lpsz new item n flags nid new item il xoffset bcmenu insertmenuw nposition nflags nidnewitem wchar_t lpsznewitem cimagelist insertodmenuw nposition lpsznewitem nflags nidnewitem bool bc menu insert menuw uint n position uint n flags uint nid new item wchar t lpsz new item c bitmap bmp if bmp c image list temp temp create m iconx m icony ilc colorddb ilc mask 1 1 if m bitmapbackgroundflag temp add bmp m bitmapbackground else temp add bmp get sys color color 3dface return insertod menuw n position lpsz new item n flags nid new item temp 0 return insertod menuw n position lpsz new item n flags nid new item null 0 bcmenu insertmenuw nposition nflags nidnewitem wchar_t lpsznewitem cbitmap cimagelist m_iconx m_icony ilc_colorddb ilc_mask m_bitmapbackgroundflag m_bitmapbackground getsyscolor color_3dface insertodmenuw nposition lpsznewitem nflags nidnewitem insertodmenuw nposition lpsznewitem nflags nidnewitem int n icon normal uses conversion return insertod menuw n position a2w lpstr text n flags nid n icon normal niconnormal uses_conversion insertodmenuw nposition lpstrtext nflags niconnormal int n icon normal if n flags mf byposition int i position 0 bc menu p menu find menu option n position i position if p menu return p menu insertod menuw i position lpstr text n flags mf byposition nid n icon normal else return false if nid n flags mf separator mf ownerdraw mf byposition else if n flags mf ownerdraw n flags mf ownerdraw int menustart 0 if n flags mf popup if m loadmenu menustart get menu start if n position uint menustart menustart 0 m allsubmenus add hmenu nid m submenus insert at n position hmenu nid stephane clog suggested adding this believe it or not it s in the help if n position uint 1 n position get menu item count bc menu data mdata new bc menu data m menulist insert at n position menustart mdata mdata set wide string lpstr text sk modified for dynamic allocation mdata menu icon normal n icon normal mdata xoffset 1 if n icon normal 0 c image list bitmap int xoffset 0 load from tool bar nid n icon normal xoffset if mdata bitmap mdata bitmap delete image list mdata bitmap null bitmap create m iconx m icony ilc colorddb ilc mask 1 1 if add bitmap to image list bitmap n icon normal mdata global offset add to global image list bitmap xoffset nid else mdata global offset global image list offset nid mdata n flags n flags mdata nid nid bool returnflag c menu insert menu n position n flags nid lpctstr mdata if m loadmenu remove top level owner draw return returnflag niconnormal nflags mf_byposition iposition bcmenu pmenu findmenuoption nposition iposition pmenu pmenu insertodmenuw iposition lpstrtext nflags mf_byposition niconnormal nflags mf_separator mf_ownerdraw mf_byposition nflags mf_ownerdraw nflags mf_ownerdraw nflags mf_popup m_loadmenu getmenustart nposition m_allsubmenus m_submenus insertat nposition nposition nposition getmenuitemcount bcmenudata bcmenudata m_menulist insertat nposition setwidestring lpstrtext menuiconnormal niconnormal niconnormal cimagelist loadfromtoolbar niconnormal deleteimagelist m_iconx m_icony ilc_colorddb ilc_mask addbitmaptoimagelist niconnormal global_offset addtoglobalimagelist global_offset globalimagelistoffset nflags nflags cmenu insertmenu nposition nflags m_loadmenu removetoplevelownerdraw c image list il int xoffset uses conversion return insertod menuw n position a2w lpstr text n flags nid il xoffset cimagelist uses_conversion insertodmenuw nposition lpstrtext nflags c image list il int xoffset if n flags mf byposition int i position 0 bc menu p menu find menu option n position i position if p menu return p menu insertod menuw i position lpstr text n flags mf byposition nid il xoffset else return false if nid n flags mf separator mf ownerdraw mf byposition else if n flags mf ownerdraw n flags mf ownerdraw if n flags mf popup m allsubmenus add hmenu nid m submenus insert at n position hmenu nid stephane clog suggested adding this believe it or not it s in the help if n position uint 1 n position get menu item count bc menu data mdata new bc menu data m menulist insert at n position mdata mdata set wide string lpstr text sk modified for dynamic allocation mdata menu icon normal 1 mdata xoffset 1 if il if mdata bitmap mdata bitmap delete image list mdata bitmap null mdata global offset add to global image list il xoffset nid mdata n flags n flags mdata nid nid return c menu insert menu n position n flags nid lpctstr mdata cimagelist nflags mf_byposition iposition bcmenu pmenu findmenuoption nposition iposition pmenu pmenu insertodmenuw iposition lpstrtext nflags mf_byposition nflags mf_separator mf_ownerdraw mf_byposition nflags mf_ownerdraw nflags mf_ownerdraw nflags mf_popup m_allsubmenus m_submenus insertat nposition nposition nposition getmenuitemcount bcmenudata bcmenudata m_menulist insertat nposition setwidestring lpstrtext menuiconnormal deleteimagelist global_offset addtoglobalimagelist nflags nflags cmenu insertmenu nposition nflags bool bc menu modifyod menua const char lpstr text uint nid int n icon normal uses conversion return modifyod menuw a2w lpstr text nid n icon normal sk see mfc tech note 059 bcmenu modifyodmenua lpstrtext niconnormal uses_conversion modifyodmenuw lpstrtext niconnormal bool bc menu modifyod menua const char lpstr text uint nid c image list il int xoffset uses conversion return modifyod menuw a2w lpstr text nid il xoffset bcmenu modifyodmenua lpstrtext cimagelist uses_conversion modifyodmenuw lpstrtext bool bc menu modifyod menua const char lpstr text uint nid c bitmap bmp uses conversion return modifyod menuw a2w lpstr text nid bmp bcmenu modifyodmenua lpstrtext cbitmap uses_conversion modifyodmenuw lpstrtext int n icon normal uses conversion return modifyod menuw a2w lpstr text a2w option text n icon normal sk see mfc tech note 059 niconnormal uses_conversion modifyodmenuw lpstrtext optiontext niconnormal bool bc menu modifyod menuw wchar t lpstr text uint nid int n icon normal int n loc bc menu data mdata c array bc menu bc menu bcsubs c array int int bclocs find the old bc menu data structure bc menu psubmenu find menu option nid n loc do if psubmenu n loc 0 mdata psubmenu m menulist n loc else create a new bc menu data structure mdata new bc menu data m menulist add mdata assert mdata if lpstr text mdata set wide string lpstr text sk modified for dynamic allocation mdata menu icon normal 1 mdata xoffset 1 if n icon normal 0 c image list bitmap int xoffset 0 load from tool bar nid n icon normal xoffset if mdata bitmap mdata bitmap delete image list mdata bitmap null bitmap create m iconx m icony ilc colorddb ilc mask 1 1 if add bitmap to image list bitmap n icon normal mdata global offset add to global image list bitmap xoffset nid else mdata global offset global image list offset nid mdata n flags mf byposition mdata n flags mf ownerdraw mdata nid nid bcsubs add psubmenu bclocs add n loc if psubmenu n loc 0 psubmenu find another menu option nid n loc bcsubs bclocs else psubmenu null while psubmenu return c menu modify menu nid mdata n flags nid lpctstr mdata bcmenu modifyodmenuw wchar_t lpstrtext niconnormal nloc bcmenudata carray bcmenu bcmenu carray bcmenudata bcmenu findmenuoption nloc nloc m_menulist nloc bcmenudata bcmenudata m_menulist lpstrtext setwidestring lpstrtext menuiconnormal niconnormal cimagelist loadfromtoolbar niconnormal deleteimagelist m_iconx m_icony ilc_colorddb ilc_mask addbitmaptoimagelist niconnormal global_offset addtoglobalimagelist global_offset globalimagelistoffset nflags mf_byposition nflags mf_ownerdraw nloc nloc findanothermenuoption nloc cmenu modifymenu nflags bool bc menu modifyod menuw wchar t lpstr text uint nid c image list il int xoffset int n loc bc menu data mdata c array bc menu bc menu bcsubs c array int int bclocs find the old bc menu data structure bc menu psubmenu find menu option nid n loc do if psubmenu n loc 0 mdata psubmenu m menulist n loc else create a new bc menu data structure mdata new bc menu data m menulist add mdata assert mdata if lpstr text mdata set wide string lpstr text sk modified for dynamic allocation mdata menu icon normal 1 mdata xoffset 1 if il if mdata bitmap mdata bitmap delete image list mdata bitmap null mdata global offset add to global image list il xoffset nid mdata n flags mf byposition mdata n flags mf ownerdraw mdata nid nid bcsubs add psubmenu bclocs add n loc if psubmenu n loc 0 psubmenu find another menu option nid n loc bcsubs bclocs else psubmenu null while psubmenu return c menu modify menu nid mdata n flags nid lpctstr mdata bcmenu modifyodmenuw wchar_t lpstrtext cimagelist nloc bcmenudata carray bcmenu bcmenu carray bcmenudata bcmenu findmenuoption nloc nloc m_menulist nloc bcmenudata bcmenudata m_menulist lpstrtext setwidestring lpstrtext menuiconnormal deleteimagelist global_offset addtoglobalimagelist nflags mf_byposition nflags mf_ownerdraw nloc nloc findanothermenuoption nloc cmenu modifymenu nflags bool bc menu modifyod menuw wchar t lpstr text uint nid c bitmap bmp if bmp c image list temp temp create m iconx m icony ilc colorddb ilc mask 1 1 if m bitmapbackgroundflag temp add bmp m bitmapbackground else temp add bmp get sys color color 3dface return modifyod menuw lpstr text nid temp 0 return modifyod menuw lpstr text nid null 0 bcmenu modifyodmenuw wchar_t lpstrtext cbitmap cimagelist m_iconx m_icony ilc_colorddb ilc_mask m_bitmapbackgroundflag m_bitmapbackground getsyscolor color_3dface modifyodmenuw lpstrtext modifyodmenuw lpstrtext int n icon normal bc menu data mdata find the old bc menu data structure c string junk option text mdata find menu option option text if mdata if lpstr text mdata set wide string lpstr text sk modified for dynamic allocation mdata menu icon normal n icon normal mdata xoffset 1 if n icon normal 0 mdata xoffset 0 if mdata bitmap mdata bitmap delete image list else mdata bitmap new c image list mdata bitmap create m iconx m icony ilc colorddb ilc mask 1 1 if add bitmap to image list mdata bitmap n icon normal mdata bitmap delete image list delete mdata bitmap mdata bitmap null mdata menu icon normal n icon normal 1 mdata xoffset 1 return true return false niconnormal bcmenudata bcmenudata cstring optiontext findmenuoption optiontext lpstrtext setwidestring lpstrtext menuiconnormal niconnormal niconnormal deleteimagelist cimagelist m_iconx m_icony ilc_colorddb ilc_mask addbitmaptoimagelist niconnormal deleteimagelist menuiconnormal niconnormal bool bc menu modifyod menua const char lpstr text uint nid colorref fill colorref border int hatchstyle c size p size uses conversion return modifyod menuw a2w lpstr text nid fill border hatchstyle p size bcmenu modifyodmenua lpstrtext csize psize uses_conversion modifyodmenuw lpstrtext psize bool bc menu modifyod menuw wchar t lpstr text uint nid colorref fill colorref border int hatchstyle c size p size c wnd p wnd afx get main wnd get main window cdc pdc p wnd getdc get device context size sz if p size sz cx m iconx sz cy m icony else sz cx p size cx sz cy p size cy c size bitmap size sz c size icon size m iconx m icony c bitmap bmp color bitmap pdc bmp bitmap size icon size fill border hatchstyle p wnd releasedc pdc return modifyod menuw lpstr text nid bmp bcmenu modifyodmenuw wchar_t lpstrtext csize psize cwnd pwnd afxgetmainwnd pwnd psize m_iconx m_icony psize psize csize bitmap_size csize icon_size m_iconx m_icony cbitmap colorbitmap bitmap_size icon_size pwnd modifyodmenuw lpstrtext bool bc menu remove menu uint ui id uint n flags if mf byposition n flags uint uint get menu state ui id mf byposition if uint mf separator uint mf popup delete m menulist get at ui id m menulist remove at ui id else bc menu p sub menu bc menu get sub menu ui id if null p sub menu uint ui command id get menu itemid ui id for int i 0 i m menulist get size i if m menulist i nid ui command id delete m menulist get at i m menulist remove at i break else int num sub menus m submenus get upper bound for int m num sub menus m 0 m if m submenus m p sub menu m hmenu int num all sub menus m allsubmenus get upper bound for int n num all sub menus n 0 n if m allsubmenus n m submenus m m allsubmenus remove at n m submenus remove at m int num p sub menu get menu item count for int i num 1 i 0 i p sub menu remove menu i mf byposition for i m menulist get upper bound i 0 i if m menulist i nid uint p sub menu m hmenu delete m menulist get at i m menulist remove at i break delete p sub menu else int i position 0 bc menu p menu find menu option ui id i position bug fix ria 14th september 2000 failed to return correct value on call to remove menu as the item was removed twice the second time its not found so a value of 0 was being returned if p menu return p menu remove menu i position mf byposition added return return c menu remove menu ui id n flags bcmenu removemenu uiid nflags mf_byposition nflags getmenustate uiid mf_byposition mf_separator mf_popup m_menulist getat uiid m_menulist removeat uiid bcmenu psubmenu bcmenu getsubmenu uiid psubmenu uicommandid getmenuitemid uiid m_menulist getsize m_menulist uicommandid m_menulist getat m_menulist removeat numsubmenus m_submenus getupperbound numsubmenus m_submenus psubmenu m_hmenu numallsubmenus m_allsubmenus getupperbound numallsubmenus m_allsubmenus m_submenus m_allsubmenus removeat m_submenus removeat psubmenu getmenuitemcount psubmenu removemenu mf_byposition m_menulist getupperbound m_menulist psubmenu m_hmenu m_menulist getat m_menulist removeat psubmenu iposition bcmenu pmenu findmenuoption uiid iposition pmenu pmenu removemenu iposition mf_byposition cmenu removemenu uiid nflags bool bc menu delete menu uint ui id uint n flags if mf byposition n flags uint uint get menu state ui id mf byposition if uint mf separator uint mf popup make sure it s a separator int menulistsize m menulist get size if ui id uint menulistsize c string str m menulist ui id get string if str delete m menulist get at ui id m menulist remove at ui id else bc menu p sub menu bc menu get sub menu ui id if null p sub menu uint ui command id get menu itemid ui id for int i 0 i m menulist get size i if m menulist i nid ui command id delete m menulist get at i m menulist remove at i break else int num sub menus m submenus get upper bound for int m num sub menus m 0 m if m submenus m p sub menu m hmenu int num all sub menus m allsubmenus get upper bound for int n num all sub menus n 0 n if m allsubmenus n m submenus m m allsubmenus remove at n m submenus remove at m int num p sub menu get menu item count for int i num 1 i 0 i p sub menu delete menu i mf byposition for i m menulist get upper bound i 0 i if m menulist i nid uint p sub menu m hmenu delete m menulist get at i m menulist remove at i break delete p sub menu else int i position 0 bc menu p menu find menu option ui id i position if p menu return p menu delete menu i position mf byposition return c menu delete menu ui id n flags bcmenu deletemenu uiid nflags mf_byposition nflags getmenustate uiid mf_byposition mf_separator mf_popup m_menulist getsize uiid cstring m_menulist uiid getstring m_menulist getat uiid m_menulist removeat uiid bcmenu psubmenu bcmenu getsubmenu uiid psubmenu uicommandid getmenuitemid uiid m_menulist getsize m_menulist uicommandid m_menulist getat m_menulist removeat numsubmenus m_submenus getupperbound numsubmenus m_submenus psubmenu m_hmenu numallsubmenus m_allsubmenus getupperbound numallsubmenus m_allsubmenus m_submenus m_allsubmenus removeat m_submenus removeat psubmenu getmenuitemcount psubmenu deletemenu mf_byposition m_menulist getupperbound m_menulist psubmenu m_hmenu m_menulist getat m_menulist removeat psubmenu iposition bcmenu pmenu findmenuoption uiid iposition pmenu pmenu deletemenu iposition mf_byposition cmenu deletemenu uiid nflags int bc menu remove menu char p text bc seperator s pos uses conversion return remove menu a2w p text s pos bcmenu removemenu ptext bc_seperator spos uses_conversion removemenu ptext spos int bc menu remove menu wchar t p text bc seperator s pos int n pos get menu position p text if n pos 1 remove menu n pos mf byposition if s pos bcmenu head assert n pos 1 0 remove menu n pos 1 mf byposition else if s pos bcmenu tail remove menu n pos 1 mf byposition else if s pos bcmenu both remove the end first remove menu n pos 1 mf byposition remove the head assert n pos 1 0 remove menu n pos 1 mf byposition return n pos bcmenu removemenu wchar_t ptext bc_seperator spos npos getmenuposition ptext npos removemenu npos mf_byposition spos bcmenu_head npos removemenu npos mf_byposition spos bcmenu_tail removemenu npos mf_byposition spos bcmenu_both removemenu npos mf_byposition npos removemenu npos mf_byposition npos int bc menu delete menu char p text bc seperator s pos uses conversion return delete menu a2w p text s pos bcmenu deletemenu ptext bc_seperator spos uses_conversion deletemenu ptext spos int bc menu delete menu wchar t p text bc seperator s pos int n pos get menu position p text if n pos 1 delete menu n pos mf byposition if s pos bcmenu head assert n pos 1 0 delete menu n pos 1 mf byposition else if s pos bcmenu tail delete menu n pos 1 mf byposition else if s pos bcmenu both remove the end first delete menu n pos 1 mf byposition remove the head assert n pos 1 0 delete menu n pos 1 mf byposition return n pos bcmenu deletemenu wchar_t ptext bc_seperator spos npos getmenuposition ptext npos deletemenu npos mf_byposition spos bcmenu_head npos deletemenu npos mf_byposition spos bcmenu_tail deletemenu npos mf_byposition spos bcmenu_both deletemenu npos mf_byposition npos deletemenu npos mf_byposition npos bool bc menu destroy menu destroy sub menus int m n int num all sub menus m allsubmenus get upper bound for n num all sub menus n 0 n if m allsubmenus n this m hmenu m allsubmenus remove at n int num sub menus m submenus get upper bound for m num sub menus m 0 m num all sub menus m allsubmenus get upper bound for n num all sub menus n 0 n if m allsubmenus n m submenus m m allsubmenus remove at n c menu ptr from handle m submenus m bool flag ptr is kind of runtime class bc menu if flag delete bc menu ptr m submenus remove all destroy menu data int num items m menulist get upper bound for m 0 m num items m delete m menulist m m menulist remove all if checkmaps checkmapsshare delete checkmaps checkmaps null call base class implementation last return c menu destroy menu bcmenu destroymenu numallsubmenus m_allsubmenus getupperbound numallsubmenus m_allsubmenus m_hmenu m_allsubmenus removeat numsubmenus m_submenus getupperbound numsubmenus numallsubmenus m_allsubmenus getupperbound numallsubmenus m_allsubmenus m_submenus m_allsubmenus removeat cmenu fromhandle m_submenus iskindof runtime_class bcmenu bcmenu m_submenus removeall numitems m_menulist getupperbound numitems m_menulist m_menulist removeall cmenu destroymenu bool bc menu get menu text uint id c string string uint n flags mf byposition bool returnflag false if mf byposition n flags uint num menu items m menulist get upper bound if id num menu items string m menulist id get string returnflag true else int ui loc bc menu p menu find menu option id ui loc if null p menu returnflag p menu get menu text ui loc string return returnflag bcmenu getmenutext cstring nflags mf_byposition mf_byposition nflags nummenuitems m_menulist getupperbound nummenuitems m_menulist getstring uiloc bcmenu pmenu findmenuoption uiloc pmenu pmenu getmenutext uiloc bool bc menu set menu text uint id c string string uint n flags mf byposition bool returnflag false if mf byposition n flags uint num menu items m menulist get upper bound if id num menu items ifdef unicode m menulist id set wide string lpctstr string else m menulist id set ansi string string endif returnflag true else int ui loc bc menu p menu find menu option id ui loc if null p menu returnflag p menu set menu text ui loc string return returnflag bcmenu setmenutext cstring nflags mf_byposition mf_byposition nflags nummenuitems m_menulist getupperbound nummenuitems m_menulist setwidestring m_menulist setansistring uiloc bcmenu pmenu findmenuoption uiloc pmenu pmenu setmenutext uiloc bc menu bc menu get subbc menu char p text uses conversion return get subbc menu a2w p text bcmenu bcmenu getsubbcmenu ptext uses_conversion getsubbcmenu ptext bc menu bc menu get subbc menu wchar t lpsz sub menu name bc menu data mdata mdata find menu option lpsz sub menu name if mdata hmenu bchmenu hmenu mdata nid c menu ptr from handle bchmenu bool flag ptr is kind of runtime class bc menu if flag return bc menu ptr return null bcmenu bcmenu getsubbcmenu wchar_t lpszsubmenuname bcmenudata findmenuoption lpszsubmenuname cmenu fromhandle iskindof runtime_class bcmenu bcmenu c menu bc menu get sub menu lpctstr lpsz sub menu name int num get menu item count c string name for int i 0 i num i get menu string i name mf byposition if name compare lpsz sub menu name 0 return c menu get sub menu i return null cmenu bcmenu getsubmenu lpszsubmenuname getmenuitemcount cstring getmenustring mf_byposition lpszsubmenuname cmenu getsubmenu c menu bc menu get sub menu int n pos return c menu get sub menu n pos cmenu bcmenu getsubmenu npos cmenu getsubmenu npos int bc menu get menu position char p text uses conversion return get menu position a2w p text bcmenu getmenuposition ptext uses_conversion getmenuposition ptext int bc menu get menu position wchar t p text int i j bc menu psubmenu for i 0 i int get menu item count i psubmenu bc menu get sub menu i if psubmenu const wchar t sz wide sk we use const to prevent misuse of this ptr for j 0 j m menulist get upper bound j sz wide m menulist j get wide string if sz wide wcscmp p text sz wide sk modified for dynamic allocation return j means no found return 1 bcmenu getmenuposition wchar_t ptext bcmenu getmenuitemcount bcmenu getsubmenu wchar_t szwide m_menulist getupperbound szwide m_menulist getwidestring szwide ptext szwide void bc menu draw item lpdrawitemstruct lpdis assert lpdis null cdc pdc cdc from handle lpdis hdc if pdc get device caps rastercaps rc palette drawitem win9xnt2000 lpdis else if is winxp luna if xp drawmode bcmenu drawmode xp drawitem winxp lpdis else drawitem win9xnt2000 lpdis else if original drawmode bcmenu drawmode xp drawitem winxp lpdis else drawitem win9xnt2000 lpdis bcmenu drawitem fromhandle getdevicecaps rc_palette drawitem_win9xnt2000 iswinxpluna xp_drawmode bcmenu_drawmode_xp drawitem_winxp drawitem_win9xnt2000 original_drawmode bcmenu_drawmode_xp drawitem_winxp drawitem_win9xnt2000 void bc menu measure item lpmeasureitemstruct lpmis uint state bc menu data lpmis item data n flags int bcmenu pad 4 if is luna menu style xp draw 3d bitmaps bcmenu pad 7 if state mf separator lpmis item width 0 int temp get system metrics sm cymenu 1 if is luna menu style lpmis item height 3 else lpmis item height temp m icony bcmenu pad 2 temp m icony bcmenu pad 2 else c font m fontmenu logfont m lf zero memory pvoid m lf sizeof logfont nonclientmetrics nm nm cb size sizeof nonclientmetrics verify system parameters info spi getnonclientmetrics nm cb size nm 0 m lf nm lf menu font m fontmenu create font indirect m lf obtain the width of the text c wnd p wnd afx get main wnd get main window if p wnd null p wnd c wnd get desktop window cdc pdc p wnd getdc get device context c font p font null select menu font in if is new shell p font pdc select object m fontmenu select menu font in get pointer to text sk const wchar t lpstr text bc menu data lpmis item data get wide string sk we use const to prevent misuse size size size cx size cy 0 if win32s g shell verify get text extent point32w pdc m hdc lpstr text wcslen lpstr text size sk should also work on 95 ifndef unicode can t be unicode for win32s else it s win32suckx rect rect rect left rect top 0 size cy draw text pdc m hdc lpctstr lpstr text wcslen lpstr text rect dt singleline dt left dt vcenter dt calcrect 3 makes at least three pixels space to the menu border size cx rect right rect left 3 size cx 3 size cx wcslen lpstr text endif c size t c size size if is new shell pdc select object p font select old font in p wnd releasedc pdc release the dc set width and height if is luna menu style lpmis item width m iconx bcmenu pad 8 t cx else lpmis item width m iconx t cx m iconx bcmenu gap int temp get system metrics sm cymenu lpmis item height temp m icony bcmenu pad temp m icony bcmenu pad m fontmenu delete object bcmenu measureitem bcmenudata itemdata nflags bcmenu_pad islunamenustyle xp_draw_3d_bitmaps bcmenu_pad mf_separator itemwidth getsystemmetrics sm_cymenu islunamenustyle itemheight itemheight m_icony bcmenu_pad m_icony bcmenu_pad cfont m_fontmenu m_lf zeromemory m_lf cbsize systemparametersinfo spi_getnonclientmetrics cbsize m_lf lfmenufont m_fontmenu createfontindirect m_lf cwnd pwnd afxgetmainwnd pwnd pwnd cwnd getdesktopwindow pwnd cfont pfont isnewshell pfont selectobject m_fontmenu wchar_t lpstrtext bcmenudata itemdata getwidestring g_shell gettextextentpoint32w m_hdc lpstrtext lpstrtext drawtext m_hdc lpstrtext lpstrtext dt_singleline dt_left dt_vcenter dt_calcrect lpstrtext csize csize isnewshell selectobject pfont pwnd islunamenustyle itemwidth m_iconx bcmenu_pad itemwidth m_iconx m_iconx bcmenu_gap getsystemmetrics sm_cymenu itemheight m_icony bcmenu_pad m_icony bcmenu_pad m_fontmenu deleteobject void bc menu update menu c menu pmenu ifdef cpprtti bc menu psubmenu dynamic cast bc menu pmenu else bc menu psubmenu bc menu pmenu endif if psubmenu psubmenu synchronize menu bcmenu updatemenu cmenu _cpprtti bcmenu dynamic_cast bcmenu bcmenu bcmenu synchronizemenu bool bc menu is menu c menu submenu int m int num sub menus m allsubmenus get upper bound for m 0 m num sub menus m if submenu m hmenu m allsubmenus m return true return false bcmenu ismenu cmenu numsubmenus m_allsubmenus getupperbound numsubmenus m_hmenu m_allsubmenus bool bc menu is menu hmenu submenu int m int num sub menus m allsubmenus get upper bound for m 0 m num sub menus m if submenu m allsubmenus m return true return false bcmenu ismenu numsubmenus m_allsubmenus getupperbound numsubmenus m_allsubmenus c menu p menu ifdef cpprtti bc menu pbc menu dynamic cast bc menu p menu else bc menu pbc menu bc menu p menu endif if pbc menu n flags mf popup c string key t 2 sk modified for unicode correctness key set at 1 tchar n char key make lower c string menutext int menusize int pbc menu get menu item count if menusize pbc menu m menulist get upper bound 1 pbc menu synchronize menu for int i 0 i menusize i if pbc menu get menu text i menutext menutext make lower if menutext find key 0 return makelresult i 2 return 0 cmenu pmenu _cpprtti bcmenu pbcmenu dynamic_cast bcmenu pmenu bcmenu pbcmenu bcmenu pmenu pbcmenu nflags mf_popup cstring _t setat nchar makelower cstring pbcmenu getmenuitemcount pbcmenu m_menulist getupperbound pbcmenu synchronizemenu pbcmenu getmenutext makelower function to set how menu is drawn either original or xp style static void set menu draw mode uint mode bc menu original drawmode mode bc menu xp drawmode mode setmenudrawmode bcmenu original_drawmode bcmenu xp_drawmode function to set how disabled items are drawn mode false means they are not drawn selected static void set select disable mode bool mode bc menu original select disabled mode bc menu xp select disabled mode setselectdisablemode bcmenu original_select_disabled bcmenu xp_select_disabled int bc menu get menu draw mode void if is winxp luna return xp drawmode return original drawmode bcmenu getmenudrawmode iswinxpluna xp_drawmode original_drawmode bool bc menu get select disable mode void if is luna menu style return xp select disabled return original select disabled bcmenu getselectdisablemode islunamenustyle xp_select_disabled original_select_disabled how the bitmaps are drawn in xp luna mode static void setxp bitmap3d bool val bc menu xp draw 3d bitmaps val setxpbitmap3d bcmenu xp_draw_3d_bitmaps void bc menu set icon size int width int height m iconx width m icony height bcmenu seticonsize m_iconx m_icony void bc menu set bitmap background colorref color m bitmapbackground color m bitmapbackgroundflag true bcmenu setbitmapbackground m_bitmapbackground m_bitmapbackgroundflag void bc menu un set bitmap background void m bitmapbackgroundflag false bcmenu unsetbitmapbackground m_bitmapbackgroundflag bool bc menu get disable old style void return disable old style bcmenu getdisableoldstyle disable_old_style void bc menu set disable old style void disable old style true bcmenu setdisableoldstyle disable_old_style void bc menu un set disable old style void disable old style false bcmenu unsetdisableoldstyle disable_old_style colorref bc menu lighten color colorref col double factor if factor 0 0 factor 1 0 byte red green blue lightred lightgreen lightblue red getr value col green getg value col blue getb value col lightred byte factor 255 red red lightgreen byte factor 255 green green lightblue byte factor 255 blue blue col rgb lightred lightgreen lightblue return col bcmenu lightencolor getrvalue getgvalue getbvalue colorref bc menu darken color colorref col double factor if factor 0 0 factor 1 0 byte red green blue lightred lightgreen lightblue red getr value col green getg value col blue getb value col lightred byte red factor red lightgreen byte green factor green lightblue byte blue factor blue col rgb lightred lightgreen lightblue return col bcmenu darkencolor getrvalue getgvalue getbvalue bool bc menu is windows classic theme void tchar buf max path 10 hkey h key dword size type long l ret code static bool xptheme returnflag false static bool xptheme checkflag false if xptheme checkflag return xptheme returnflag xptheme checkflag true l ret code reg open key ex hkey current user t software microsoft plus themes current 0 key read h key if l ret code error success size max path type reg sz l ret code reg query value ex h key null null type unsigned char buf size if l ret code error success tchar sz classic theme t windows classic theme int len lstrlen buf if len lstrlen sz classic theme if lstrcmpi buf len lstrlen sz classic theme sz classic theme xptheme returnflag true reg close key h key return xptheme returnflag bcmenu iswindowsclassictheme _max_path hkey lretcode xptheme_returnflag xptheme_checkflag xptheme_checkflag xptheme_returnflag xptheme_checkflag lretcode regopenkeyex hkey_current_user _t key_read hkey lretcode error_success _max_path reg_sz lretcode regqueryvalueex hkey lretcode error_success szclassictheme _t szclassictheme szclassictheme szclassictheme xptheme_returnflag regclosekey hkey xptheme_returnflag bc menu data bc menu find menu item uint nid bc menu data p data null int i for i 0 i m menulist get upper bound i if m menulist i nid nid p data m menulist i break if p data int loc bc menu p menu find menu option nid loc assert p menu this if loc 0 return p menu find menu item nid return p data bcmenudata bcmenu findmenuitem bcmenudata pdata m_menulist getupperbound m_menulist pdata m_menulist pdata bcmenu pmenu findmenuoption pmenu pmenu findmenuitem pdata bc menu bc menu find menu option int n id int n loc int i bc menu psubmenu pgoodmenu for i 0 i int get menu item count i ifdef cpprtti psubmenu dynamic cast bc menu get sub menu i else psubmenu bc menu get sub menu i endif if psubmenu pgoodmenu psubmenu find menu option n id n loc if pgoodmenu return pgoodmenu else if n id int get menu itemid i n loc i return this n loc 1 return null bcmenu bcmenu findmenuoption nid nloc bcmenu getmenuitemcount _cpprtti dynamic_cast bcmenu getsubmenu bcmenu getsubmenu findmenuoption nid nloc nid getmenuitemid nloc nloc c array int int bclocs int i numsubs j bc menu psubmenu pgoodmenu bool foundflag for i 0 i int get menu item count i ifdef cpprtti psubmenu dynamic cast bc menu get sub menu i else psubmenu bc menu get sub menu i endif if psubmenu pgoodmenu psubmenu find another menu option n id n loc bcsubs bclocs if pgoodmenu return pgoodmenu else if n id int get menu itemid i numsubs bcsubs get size foundflag true for j 0 j numsubs j if bcsubs j this bclocs j i foundflag false break if foundflag n loc i return this n loc 1 return null carray bcmenu getmenuitemcount _cpprtti dynamic_cast bcmenu getsubmenu bcmenu getsubmenu findanothermenuoption nid nloc nid getmenuitemid getsize nloc nloc bc menu data bc menu find menu option wchar t lpstr text int i j bc menu psubmenu bc menu data pmenulist for i 0 i int get menu item count i ifdef cpprtti psubmenu dynamic cast bc menu get sub menu i else psubmenu bc menu get sub menu i endif if psubmenu pmenulist psubmenu find menu option lpstr text if pmenulist return pmenulist else const wchar t sz wide sk we use const to prevent misuse of this ptr for j 0 j m menulist get upper bound j sz wide m menulist j get wide string if sz wide wcscmp lpstr text sz wide sk modified for dynamic allocation return m menulist j return null bcmenudata bcmenu findmenuoption wchar_t lpstrtext bcmenu bcmenudata getmenuitemcount _cpprtti dynamic_cast bcmenu getsubmenu bcmenu getsubmenu findmenuoption lpstrtext wchar_t szwide m_menulist getupperbound szwide m_menulist getwidestring szwide lpstrtext szwide m_menulist void bc menu insert spaces void if is luna menu style if xp space accelerators return else if original space accelerators return int i j numitems maxlength c string string newstring c size t c font m fontmenu logfont m lf zero memory pvoid m lf sizeof logfont nonclientmetrics nm nm cb size sizeof nonclientmetrics verify system parameters info spi getnonclientmetrics nm cb size nm 0 m lf nm lf menu font m fontmenu create font indirect m lf c wnd p wnd afx get main wnd if p wnd null p wnd c wnd get desktop window cdc pdc p wnd getdc c font p font pdc select object m fontmenu numitems get menu item count maxlength 1 for i 0 i numitems i string m menulist i get string j string find char 9 newstring empty if j 1 newstring string left j else newstring string newstring t sk modified for unicode correctness lpctstr lpstr text lpctstr newstring t pdc get text extent lpstr text tcslen lpstr text if t cx maxlength maxlength t cx for i 0 i numitems i string m menulist i get string j string find char 9 if j 1 newstring empty newstring string left j lpctstr lpstr text lpctstr newstring t pdc get text extent lpstr text tcslen lpstr text while t cx maxlength newstring t sk modified for unicode correctness lpctstr lpstr text lpctstr newstring t pdc get text extent lpstr text tcslen lpstr text newstring string mid j ifdef unicode m menulist i set wide string newstring sk modified for dynamic allocation else m menulist i set ansi string newstring endif pdc select object p font select old font in p wnd releasedc pdc release the dc m fontmenu delete object bcmenu insertspaces islunamenustyle xp_space_accelerators original_space_accelerators cstring csize cfont m_fontmenu m_lf zeromemory m_lf cbsize systemparametersinfo spi_getnonclientmetrics cbsize m_lf lfmenufont m_fontmenu createfontindirect m_lf cwnd pwnd afxgetmainwnd pwnd pwnd cwnd getdesktopwindow pwnd cfont pfont selectobject m_fontmenu getmenuitemcount m_menulist getstring _t lpstrtext gettextextent lpstrtext _tcslen lpstrtext m_menulist getstring lpstrtext gettextextent lpstrtext _tcslen lpstrtext _t lpstrtext gettextextent lpstrtext _tcslen lpstrtext m_menulist setwidestring m_menulist setansistring selectobject pfont pwnd m_fontmenu deleteobject void bc menu draw check mark cdc pdc int x int y colorref color bool narrowflag int dp 0 c pen m penback m penback create pen ps solid 0 color c pen p old pen pdc select object m penback if narrowflag dp 1 pdc move to x y 2 pdc line to x y 5 dp pdc move to x 1 y 3 pdc line to x 1 y 6 dp pdc move to x 2 y 4 pdc line to x 2 y 7 dp pdc move to x 3 y 3 pdc line to x 3 y 6 dp pdc move to x 4 y 2 pdc line to x 4 y 5 dp pdc move to x 5 y 1 pdc line to x 5 y 4 dp pdc move to x 6 y pdc line to x 6 y 3 dp pdc select object p old pen m penback delete object bcmenu drawcheckmark cpen m_penback m_penback createpen ps_solid cpen poldpen selectobject m_penback moveto lineto moveto lineto moveto lineto moveto lineto moveto lineto moveto lineto moveto lineto selectobject poldpen m_penback deleteobject void bc menu draw radio dot cdc pdc int x int y colorref color c rect rc dot x y x 6 y 6 c brush brush c pen pen brush create solid brush color pen create pen ps solid 0 color c brush p old brush pdc select object brush c pen p old pen pdc select object pen pdc ellipse rc dot pdc select object p old brush pdc select object p old pen pen delete object brush delete object bcmenu drawradiodot crect rcdot cbrush cpen createsolidbrush createpen ps_solid cbrush poldbrush selectobject cpen poldpen selectobject rcdot selectobject poldbrush selectobject poldpen deleteobject deleteobject bc menu data bc menu newod menu uint pos uint n flags uint nid c string string bc menu data mdata mdata new bc menu data mdata menu icon normal 1 mdata xoffset 1 ifdef unicode mdata set wide string lpctstr string sk modified for dynamic allocation else mdata set ansi string string endif mdata n flags n flags mdata nid nid if n flags mf popup m allsubmenus add hmenu nid if n flags mf ownerdraw assert n flags mf string modify menu pos n flags nid lpctstr mdata else if n flags mf string assert n flags mf ownerdraw modify menu pos n flags nid mdata get string else assert n flags mf separator modify menu pos n flags nid return mdata bcmenudata bcmenu newodmenu nflags cstring bcmenudata bcmenudata menuiconnormal setwidestring setansistring nflags nflags nflags mf_popup m_allsubmenus nflags mf_ownerdraw nflags mf_string modifymenu nflags nflags mf_string nflags mf_ownerdraw modifymenu nflags getstring nflags mf_separator modifymenu nflags void bc menu synchronize menu void c typed ptr array c ptr array bc menu data temp bc menu data mdata c string string uint submenu nid 0 state j initialize menu list 0 for j 0 j get menu item count j mdata null state get menu state j mf byposition if state mf popup submenu uint get sub menu j m hmenu mdata find menu list submenu get menu string j string mf byposition if mdata mdata newod menu j state 0xff mf byposition mf popup mf ownerdraw submenu string else if string get length 0 ifdef unicode mdata set wide string string sk modified for dynamic allocation else mdata set ansi string string endif else if state mf separator mdata find menu list 0 if mdata mdata newod menu j state mf byposition mf separator mf ownerdraw 0 t sk modified for unicode correctness else modify menu j mdata n flags nid lpctstr mdata else nid get menu itemid j mdata find menu list nid get menu string j string mf byposition if mdata mdata newod menu j state mf byposition mf ownerdraw nid string else mdata n flags state mf byposition mf ownerdraw if string get length 0 ifdef unicode mdata set wide string string sk modified for dynamic allocation else mdata set ansi string string endif modify menu j mdata n flags nid lpctstr mdata if mdata temp add mdata delete menu list m menulist remove all m menulist append temp temp remove all bcmenu synchronizemenu ctypedptrarray cptrarray bcmenudata bcmenudata cstring initializemenulist getmenuitemcount getmenustate mf_byposition mf_popup getsubmenu m_hmenu findmenulist getmenustring mf_byposition newodmenu mf_byposition mf_popup mf_ownerdraw getlength setwidestring setansistring mf_separator findmenulist newodmenu mf_byposition mf_separator mf_ownerdraw _t modifymenu nflags getmenuitemid findmenulist getmenustring mf_byposition newodmenu mf_byposition mf_ownerdraw nflags mf_byposition mf_ownerdraw getlength setwidestring setansistring modifymenu nflags deletemenulist m_menulist removeall m_menulist removeall void bc menu initialize menu list int value for int i 0 i m menulist get upper bound i m menulist i syncflag value bcmenu initializemenulist m_menulist getupperbound m_menulist void bc menu delete menu list void for int i 0 i m menulist get upper bound i if m menulist i syncflag delete m menulist i bcmenu deletemenulist m_menulist getupperbound m_menulist m_menulist bc menu data bc menu find menu list uint nid for int i 0 i m menulist get upper bound i if m menulist i nid nid m menulist i syncflag m menulist i syncflag 1 return m menulist i return null bcmenudata bcmenu findmenulist m_menulist getupperbound m_menulist m_menulist m_menulist m_menulist void bc menu drawitem win9xnt2000 lpdrawitemstruct lpdis assert lpdis null cdc pdc cdc from handle lpdis hdc c rect rect uint state bc menu data lpdis item data n flags c brush m brbackground colorref m clrback if is winxp luna m clrback get sys color color 3dface else m clrback get sys color color menu m brbackground create solid brush m clrback remove the selected bit if it s grayed out if lpdis item state ods grayed original select disabled if lpdis item state ods selected lpdis item state lpdis item state ods selected if state mf separator rect copy rect lpdis rc item pdc fill rect rect m brbackground rect top rect height 1 pdc draw edge rect edge etched bf top else c rect rect2 bool standardflag false selectedflag false disableflag false bool checkflag false colorref cr text get sys color color menutext c brush m brselect c pen m penback int x0 y0 dy int n icon normal 1 xoffset 1 global offset 1 c image list bitmap null set some colors m penback create pen ps solid 0 m clrback m brselect create solid brush get sys color color highlight draw the colored rectangle portion rect copy rect lpdis rc item rect2 rect draw the up down focused disabled state uint state lpdis item state c string str text if lpdis item data null n icon normal bc menu data lpdis item data menu icon normal xoffset bc menu data lpdis item data xoffset global offset bc menu data lpdis item data global offset bitmap bc menu data lpdis item data bitmap str text bc menu data lpdis item data get string if n icon normal 0 global offset 0 xoffset global offset n icon normal 0 bitmap m allimages if state ods checked n icon normal 0 if state ods selected m selectcheck 0 checkflag true else if m unselectcheck 0 checkflag true else if n icon normal 1 standardflag true if state ods selected state ods grayed selectedflag true else if state ods grayed disableflag true else str text empty if state ods selected draw the down edges c pen p old pen pdc select object m penback you need only text highlight and thats what you get if checkflag standardflag selectedflag disableflag state ods checked rect2 set rect rect left m iconx 4 bcmenu gap rect top rect right rect bottom pdc fill rect rect2 m brselect pdc select object p old pen cr text get sys color color highlighttext else c pen p old pen pdc select object m penback pdc fill rect rect m brbackground pdc select object p old pen draw the up edges pdc draw3d rect rect m clrback m clrback draw the text if there is any we have to paint the text only if the image is nonexistant dy rect height 4 m icony 2 dy dy 0 0 dy if checkflag standardflag selectedflag disableflag rect2 set rect rect left 1 rect top 1 dy rect left m iconx 3 rect top m icony 3 dy pdc draw3d rect rect2 m clrback m clrback if checkflag checkmaps pdc fill rect rect2 m brbackground rect2 set rect rect left rect top dy rect left m iconx 4 rect top m icony 4 dy pdc draw3d rect rect2 m clrback m clrback c point pt image rect left 2 rect top 2 dy if state ods selected checkmaps draw pdc 1 pt image ild transparent else checkmaps draw pdc 0 pt image ild transparent else if disableflag if selectedflag c bitmap bitmapstandard get bitmap from image list pdc bitmap xoffset bitmapstandard rect2 set rect rect left rect top dy rect left m iconx 4 rect top m icony 4 dy pdc draw3d rect rect2 m clrback m clrback if disable old style dither blt lpdis hdc rect left 2 rect top 2 dy m iconx m icony hbitmap bitmapstandard 0 0 m clrback else if hicolor bitmaps dither blt3 pdc rect left 2 rect top 2 dy m iconx m icony bitmapstandard m clrback else dither blt2 pdc rect left 2 rect top 2 dy m iconx m icony bitmapstandard 0 0 m clrback bitmapstandard delete object else if selectedflag pdc fill rect rect2 m brbackground rect2 set rect rect left rect top dy rect left m iconx 4 rect top m icony 4 dy if is new shell if state ods checked pdc draw3d rect rect2 get sys color color 3dshadow get sys color color 3dhilight else pdc draw3d rect rect2 get sys color color 3dhilight get sys color color 3dshadow c point pt image rect left 2 rect top 2 dy if bitmap bitmap draw pdc xoffset pt image ild transparent else if state ods checked c brush brush colorref col m clrback col lighten color col 0 6 brush create solid brush col pdc fill rect rect2 brush brush delete object rect2 set rect rect left rect top dy rect left m iconx 4 rect top m icony 4 dy if is new shell pdc draw3d rect rect2 get sys color color 3dshadow get sys color color 3dhilight else pdc fill rect rect2 m brbackground rect2 set rect rect left rect top dy rect left m iconx 4 rect top m icony 4 dy pdc draw3d rect rect2 m clrback m clrback c point pt image rect left 2 rect top 2 dy if bitmap bitmap draw pdc xoffset pt image ild transparent if n icon normal 0 state ods checked checkflag rect2 set rect rect left 1 rect top 2 dy rect left m iconx 1 rect top m icony 2 dy c menu item info info info f mask miim checkmarks get menu item info hmenu lpdis hwnd item lpdis itemid mf bycommand info if state ods checked info hbmp unchecked draw3d checkmark pdc rect2 state ods selected state ods checked info hbmp checked info hbmp unchecked this is needed always so that we can have the space for check marks x0 rect left y0 rect top rect left rect left m iconx 8 bcmenu gap if str text is empty c rect rectt rect left rect top 1 rect right rect bottom 1 find tabs c string left str right str left str empty right str empty int tablocr str text reverse find t t if tablocr 1 right str str text mid tablocr 1 left str str text left str text find t t rectt right m iconx else left str str text int i old mode pdc get bk mode pdc set bk mode transparent draw the text in the correct colour uint n format dt left dt singleline dt vcenter uint n formatr dt right dt singleline dt vcenter if lpdis item state ods grayed pdc set text color cr text pdc draw text left str rectt n format if tablocr 1 pdc draw text right str rectt n formatr else draw the disabled text if state ods selected rect offset rectt offset left 1 offset right 1 offset top 1 offset bottom 1 pdc set text color get sys color color btnhilight pdc draw text left str offset n format if tablocr 1 pdc draw text right str offset n formatr pdc set text color get sys color color graytext pdc draw text left str rectt n format if tablocr 1 pdc draw text right str rectt n formatr else and the standard grey text pdc set text color m clrback pdc draw text left str rectt n format if tablocr 1 pdc draw text right str rectt n formatr pdc set bk mode i old mode m penback delete object m brselect delete object m brbackground delete object bcmenu drawitem_win9xnt2000 fromhandle crect bcmenudata itemdata nflags cbrush m_brbackground m_clrback iswinxpluna m_clrback getsyscolor color_3dface m_clrback getsyscolor color_menu m_brbackground createsolidbrush m_clrback itemstate ods_grayed original_select_disabled itemstate ods_selected itemstate itemstate ods_selected mf_separator copyrect rcitem fillrect m_brbackground drawedge edge_etched bf_top crect crtext getsyscolor color_menutext cbrush m_brselect cpen m_penback niconnormal global_offset cimagelist m_penback createpen ps_solid m_clrback m_brselect createsolidbrush getsyscolor color_highlight copyrect rcitem itemstate cstring strtext itemdata niconnormal bcmenudata itemdata menuiconnormal bcmenudata itemdata global_offset bcmenudata itemdata global_offset bcmenudata itemdata strtext bcmenudata itemdata getstring niconnormal global_offset global_offset niconnormal m_allimages ods_checked niconnormal ods_selected m_selectcheck m_unselectcheck niconnormal ods_selected ods_grayed ods_grayed strtext ods_selected cpen poldpen selectobject m_penback ods_checked setrect m_iconx bcmenu_gap fillrect m_brselect selectobject poldpen crtext getsyscolor color_highlighttext cpen poldpen selectobject m_penback fillrect m_brbackground selectobject poldpen draw3drect m_clrback m_clrback m_icony setrect m_iconx m_icony draw3drect m_clrback m_clrback fillrect m_brbackground setrect m_iconx m_icony draw3drect m_clrback m_clrback cpoint ptimage ods_selected ptimage ild_transparent ptimage ild_transparent cbitmap getbitmapfromimagelist setrect m_iconx m_icony draw3drect m_clrback m_clrback disable_old_style ditherblt m_iconx m_icony m_clrback hicolor_bitmaps ditherblt3 m_iconx m_icony m_clrback ditherblt2 m_iconx m_icony m_clrback deleteobject fillrect m_brbackground setrect m_iconx m_icony isnewshell ods_checked draw3drect getsyscolor color_3dshadow getsyscolor color_3dhilight draw3drect getsyscolor color_3dhilight getsyscolor color_3dshadow cpoint ptimage ptimage ild_transparent ods_checked cbrush m_clrback lightencolor createsolidbrush fillrect deleteobject setrect m_iconx m_icony isnewshell draw3drect getsyscolor color_3dshadow getsyscolor color_3dhilight fillrect m_brbackground setrect m_iconx m_icony draw3drect m_clrback m_clrback cpoint ptimage ptimage ild_transparent niconnormal ods_checked setrect m_iconx m_icony cmenuiteminfo fmask miim_checkmarks getmenuiteminfo hwnditem mf_bycommand ods_checked hbmpunchecked draw3dcheckmark ods_selected ods_checked hbmpchecked hbmpunchecked m_iconx bcmenu_gap strtext isempty crect cstring leftstr rightstr leftstr rightstr strtext reversefind _t rightstr strtext leftstr strtext strtext _t m_iconx leftstr strtext ioldmode getbkmode setbkmode nformat dt_left dt_singleline dt_vcenter nformatr dt_right dt_singleline dt_vcenter itemstate ods_grayed settextcolor crtext drawtext leftstr nformat drawtext rightstr nformatr ods_selected settextcolor getsyscolor color_btnhilight drawtext leftstr nformat drawtext rightstr nformatr settextcolor getsyscolor color_graytext drawtext leftstr nformat drawtext rightstr nformatr settextcolor m_clrback drawtext leftstr nformat drawtext rightstr nformatr setbkmode ioldmode m_penback deleteobject m_brselect deleteobject m_brbackground deleteobject void bc menu drawitem winxp lpdrawitemstruct lpdis assert lpdis null cdc pdc cdc from handle lpdis hdc ifdef bcmenu use memdc bc menu memdc p memdc null endif c rect rect rect2 uint state bc menu data lpdis item data n flags colorref m newclrback get sys color color 3dface colorref m clrback get sys color color window m clrback darken color m clrback 0 02 c font m fontmenu p font null logfont m lf if is winxp luna m newclrback lighten color m newclrback 0 25 c brush m newbrbackground m brbackground m brbackground create solid brush m clrback m newbrbackground create solid brush m newclrback int bcmenu pad 4 if xp draw 3d bitmaps bcmenu pad 7 int barwidth m iconx bcmenu pad remove the selected bit if it s grayed out if lpdis item state ods grayed xp select disabled if lpdis item state ods selected lpdis item state lpdis item state ods selected ifdef bcmenu use memdc p memdc new bc menu memdc pdc lpdis rc item pdc p memdc zero memory pvoid m lf sizeof logfont nonclientmetrics nm nm cb size sizeof nonclientmetrics verify system parameters info spi getnonclientmetrics nm cb size nm 0 m lf nm lf menu font m fontmenu create font indirect m lf p font pdc select object m fontmenu endif if state mf separator rect copy rect lpdis rc item pdc fill rect rect m brbackground rect2 set rect rect left rect top rect left barwidth rect bottom rect top rect height 1 rect left rect2 right bcmenu pad pdc draw edge rect edge etched bf top pdc fill rect rect2 m newbrbackground pdc draw3d rect rect2 m newclrback m newclrback else bool standardflag false selectedflag false disableflag false bool checkflag false colorref cr text get sys color color menutext colorref cr select get sys color color highlight colorref cr select fill if is winxp luna cr select fill lighten color cr select 0 85 else cr select fill lighten color cr select 0 7 c brush m brselect c pen m penback int x0 y0 dx dy int n icon normal 1 xoffset 1 global offset 1 int faded offset 1 shadow offset 2 disabled offset 3 c image list bitmap null bool can draw3d false set some colors m penback create pen ps solid 0 m clrback m brselect create solid brush cr select fill draw the colored rectangle portion rect copy rect lpdis rc item rect2 rect draw the up down focused disabled state uint state lpdis item state c string str text if lpdis item data null n icon normal bc menu data lpdis item data menu icon normal xoffset bc menu data lpdis item data xoffset bitmap bc menu data lpdis item data bitmap str text bc menu data lpdis item data get string global offset bc menu data lpdis item data global offset if xoffset 0 xp draw 3d bitmaps bitmap bitmap get image count 2 can draw3d true if n icon normal 0 xoffset 0 global offset 0 xoffset global offset n icon normal 0 bitmap m allimages if xp draw 3d bitmaps can draw3d image list global offset can draw3d true faded offset global offset 1 shadow offset global offset 2 disabled offset global offset 3 if state ods checked n icon normal 0 if state ods selected m selectcheck 0 checkflag true else if m unselectcheck 0 checkflag true else if n icon normal 1 standardflag true if state ods selected state ods grayed selectedflag true else if state ods grayed disableflag true else str text empty if state ods selected draw the down edges c pen p old pen pdc select object m penback pdc fill rect rect m brselect pdc draw3d rect rect cr select cr select pdc select object p old pen else rect2 set rect rect left rect top rect left barwidth rect bottom c pen p old pen pdc select object m penback pdc fill rect rect m brbackground pdc fill rect rect2 m newbrbackground pdc select object p old pen draw the up edges pdc draw3d rect rect m clrback m clrback pdc draw3d rect rect2 m newclrback m newclrback draw the text if there is any we have to paint the text only if the image is nonexistant dy int 0 5 rect height m icony 2 0 dy dy 0 0 dy dx int 0 5 barwidth m iconx 2 0 dx dx 0 0 dx rect2 set rect rect left 1 rect top 1 rect left barwidth 2 rect bottom 1 if checkflag standardflag selectedflag disableflag if checkflag checkmaps pdc fill rect rect2 m newbrbackground c point pt image rect left dx rect top dy if state ods selected checkmaps draw pdc 1 pt image ild transparent else checkmaps draw pdc 0 pt image ild transparent else if disableflag if selectedflag if can draw3d c point pt image rect left dx rect top dy bitmap draw pdc disabled offset pt image ild transparent else c bitmap bitmapstandard get bitmap from image list pdc bitmap xoffset bitmapstandard colorref transparentcol m newclrback if state ods selected transparentcol cr select fill if disable old style dither blt lpdis hdc rect left dx rect top dy m iconx m icony hbitmap bitmapstandard 0 0 transparentcol else dither blt2 pdc rect left dx rect top dy m iconx m icony bitmapstandard 0 0 transparentcol if state ods selected pdc draw3d rect rect cr select cr select bitmapstandard delete object else if selectedflag c point pt image rect left dx rect top dy if state ods checked c brush brushin brushin create solid brush lighten color cr select 0 55 pdc fill rect rect2 brushin brushin delete object pdc draw3d rect rect2 cr select cr select pt image x 1 pt image y 1 else pdc fill rect rect2 m brselect if bitmap if can draw3d state ods checked c point pt image1 pt image x 1 pt image y 1 c point pt image2 pt image x 1 pt image y 1 bitmap draw pdc shadow offset pt image1 ild transparent bitmap draw pdc xoffset pt image2 ild transparent else bitmap draw pdc xoffset pt image ild transparent else if state ods checked c brush brushin brushin create solid brush lighten color cr select 0 85 pdc fill rect rect2 brushin brushin delete object pdc draw3d rect rect2 cr select cr select c point pt image rect left dx 1 rect top dy 1 if bitmap bitmap draw pdc xoffset pt image ild transparent else pdc fill rect rect2 m newbrbackground pdc draw3d rect rect2 m newclrback m newclrback c point pt image rect left dx rect top dy if bitmap if can draw3d bitmap draw pdc faded offset pt image ild transparent else bitmap draw pdc xoffset pt image ild transparent if n icon normal 0 state ods checked checkflag c menu item info info info f mask miim checkmarks get menu item info hmenu lpdis hwnd item lpdis itemid mf bycommand info if state ods checked info hbmp unchecked drawxp checkmark pdc rect2 state ods checked info hbmp checked info hbmp unchecked cr select state ods selected this is needed always so that we can have the space for check marks x0 rect left y0 rect top rect left rect left barwidth 8 if str text is empty c rect rectt rect left rect top 1 rect right rect bottom 1 find tabs c string left str right str left str empty right str empty int tablocr str text reverse find t t if tablocr 1 right str str text mid tablocr 1 left str str text left str text find t t rectt right m iconx else left str str text int i old mode pdc get bk mode pdc set bk mode transparent draw the text in the correct colour uint n format dt left dt singleline dt vcenter uint n formatr dt right dt singleline dt vcenter if lpdis item state ods grayed pdc set text color cr text pdc draw text left str rectt n format if tablocr 1 pdc draw text right str rectt n formatr else rect offset rectt offset left 1 offset right 1 offset top 1 offset bottom 1 if is winxp luna colorref graycol get sys color color graytext if state ods selected graycol lighten color graycol 0 4 pdc set text color graycol else pdc set text color get sys color color graytext pdc draw text left str rectt n format if tablocr 1 pdc draw text right str rectt n formatr pdc set bk mode i old mode m penback delete object m brselect delete object m brbackground delete object m newbrbackground delete object ifdef bcmenu use memdc if p font pdc select object p font set it to the old font m fontmenu delete object if p memdc delete p memdc endif bcmenu drawitem_winxp fromhandle bcmenu_use_memdc bcmenumemdc pmemdc crect bcmenudata itemdata nflags m_newclrback getsyscolor color_3dface m_clrback getsyscolor color_window m_clrback darkencolor m_clrback cfont m_fontmenu pfont m_lf iswinxpluna m_newclrback lightencolor m_newclrback cbrush m_newbrbackground m_brbackground m_brbackground createsolidbrush m_clrback m_newbrbackground createsolidbrush m_newclrback bcmenu_pad xp_draw_3d_bitmaps bcmenu_pad m_iconx bcmenu_pad itemstate ods_grayed xp_select_disabled itemstate ods_selected itemstate itemstate ods_selected bcmenu_use_memdc pmemdc bcmenumemdc rcitem pmemdc zeromemory m_lf cbsize systemparametersinfo spi_getnonclientmetrics cbsize m_lf lfmenufont m_fontmenu createfontindirect m_lf pfont selectobject m_fontmenu mf_separator copyrect rcitem fillrect m_brbackground setrect bcmenu_pad drawedge edge_etched bf_top fillrect m_newbrbackground draw3drect m_newclrback m_newclrback crtext getsyscolor color_menutext crselect getsyscolor color_highlight crselectfill iswinxpluna crselectfill lightencolor crselect crselectfill lightencolor crselect cbrush m_brselect cpen m_penback niconnormal global_offset faded_offset shadow_offset disabled_offset cimagelist candraw3d m_penback createpen ps_solid m_clrback m_brselect createsolidbrush crselectfill copyrect rcitem itemstate cstring strtext itemdata niconnormal bcmenudata itemdata menuiconnormal bcmenudata itemdata bcmenudata itemdata strtext bcmenudata itemdata getstring global_offset bcmenudata itemdata global_offset xp_draw_3d_bitmaps getimagecount candraw3d niconnormal global_offset global_offset niconnormal m_allimages xp_draw_3d_bitmaps candraw3dimagelist global_offset candraw3d faded_offset global_offset shadow_offset global_offset disabled_offset global_offset ods_checked niconnormal ods_selected m_selectcheck m_unselectcheck niconnormal ods_selected ods_grayed ods_grayed strtext ods_selected cpen poldpen selectobject m_penback fillrect m_brselect draw3drect crselect crselect selectobject poldpen setrect cpen poldpen selectobject m_penback fillrect m_brbackground fillrect m_newbrbackground selectobject poldpen draw3drect m_clrback m_clrback draw3drect m_ne bool b selected hbitmap hbm check c rect rc dest rc c brush brush colorref col if is winxp luna col get sys color color 3dface else col get sys color color menu if b selected col lighten color col 0 6 brush create solid brush col dc fill rect rc dest brush brush delete object if is new shell sk looks better on the old shell dc draw edge rc dest bdr sunkenouter bf rect if hbm check draw check mark dc rc left 4 rc top 4 get sys color color menutext else draw radio dot dc rc left 5 rc top 4 get sys color color menutext return true bselected hbmcheck crect rcdest cbrush iswinxpluna getsyscolor color_3dface getsyscolor color_menu bselected lightencolor createsolidbrush fillrect rcdest deleteobject isnewshell drawedge rcdest bdr_sunkenouter bf_rect hbmcheck drawcheckmark getsyscolor color_menutext drawradiodot getsyscolor color_menutext bool bc menu drawxp checkmark cdc dc const c rect rc hbitmap hbm check colorref colorout bool selected c brush brushin colorref col int dx dy dy rc height 1 3 dy dy 0 0 dy dx rc width 1 3 dx dx 0 0 dx if selected col lighten color colorout 0 55 else col lighten color colorout 0 85 brushin create solid brush col dc fill rect rc brushin brushin delete object dc draw3d rect rc colorout colorout if hbm check draw check mark dc rc left dx rc top dy get sys color color menutext true else draw radio dot dc rc left dx rc top dy get sys color color menutext return true bcmenu drawxpcheckmark crect hbmcheck cbrush lightencolor lightencolor createsolidbrush fillrect deleteobject draw3drect hbmcheck drawcheckmark getsyscolor color_menutext drawradiodot getsyscolor color_menutext colorref bgcolor assert hdc dest hbm assert n width 0 n height 0 create a generic dc for all bit blts hdc hdc create compatibledc hdc dest assert hdc if hdc create a dc for the monochrome dib section hdc bwdc create compatibledc hdc assert bwdc if bwdc create the monochrome dib section with a black and white palette struct bitmapinfoheader bmi header rgbquad bmi colors 2 rgbbwbitmapinfo a bitmapinfoheader sizeof bitmapinfoheader bi size n width bi width n height bi height 1 bi planes 1 bi bit count bi rgb bi compression 0 bi size image 0 bix pels per meter 0 biy pels per meter 0 bi clr used 0 bi clr important 0x00 0x00 0x00 0x00 0xff 0xff 0xff 0x00 void pbitsbw hbitmap hbmbw createdib section bwdc lpbitmapinfo rgbbwbitmapinfo dib rgb colors pbitsbw null 0 assert hbmbw if hbmbw attach the monochrome dib section and the bitmap to the d cs hbitmap olddib hbitmap select object bwdc hbmbw hbitmap hdcolddib hbitmap select object hdc hbm bit blt the bitmap into the monochrome dib section bit blt bwdc 0 0 n width n height hdc nx src ny src srccopy paint the destination rectangle in gray fill rect hdc dest c rect nx dest ny dest nx dest n width ny dest n height get sys color brush bgcolor sk looks better on the old shell bit blt the black bits in the monochrome bitmap into color 3dhilight bits in the destination dc the magic rop comes from the charles petzold s book hbrush hb create solid brush get sys color color 3dhilight hbrush old brush hbrush select object hdc dest hb bit blt hdc dest nx dest 1 ny dest 1 n width n height bwdc 0 0 0xb8074a bit blt the black bits in the monochrome bitmap into color 3dshadow bits in the destination dc hb create solid brush get sys color color 3dshadow delete object select object hdc dest hb bit blt hdc dest nx dest ny dest n width n height bwdc 0 0 0xb8074a delete object select object hdc dest old brush verify delete object select object bwdc olddib select object hdc hdcolddib verify deletedc bwdc verify deletedc hdc hdcdest nwidth nheight bitblts createcompatibledc hdcdest createcompatibledc bmiheader bmicolors bisize nwidth biwidth nheight biheight biplanes bibitcount bi_rgb bicompression bisizeimage bixpelspermeter biypelspermeter biclrused biclrimportant createdibsection dib_rgb_colors dcs selectobject selectobject bitblt bitblt nwidth nheight nxsrc nysrc fillrect hdcdest crect nxdest nydest nxdest nwidth nydest nheight getsyscolorbrush bitblt color_3dhilight createsolidbrush getsyscolor color_3dhilight oldbrush selectobject hdcdest bitblt hdcdest nxdest nydest nwidth nheight bitblt color_3dshadow createsolidbrush getsyscolor color_3dshadow deleteobject selectobject hdcdest bitblt hdcdest nxdest nydest nwidth nheight deleteobject selectobject hdcdest oldbrush deleteobject selectobject selectobject colorref bgcolor create a monochrome memory dc cdc ddc ddc create compatibledc 0 c bitmap bwbmp bwbmp create compatible bitmap ddc n width n height c bitmap pddc old bmp ddc select object bwbmp cdc dc dc create compatibledc 0 c bitmap pdc old bmp dc select object bmp build a mask ddc pat blt 0 0 n width n height whiteness dc set bk color get sys color color btnface ddc bit blt 0 0 n width n height dc nx src ny src srccopy dc set bk color get sys color color btnhilight ddc bit blt 0 0 n width n height dc nx src ny src srcpaint copy the image from the toolbar into the memory dc and draw it grayed back into the toolbar dc fill solid rect 0 0 n width n height bgcolor sk looks better on the old shell dc set bk color rgb 0 0 0 dc set text color rgb 255 255 255 c brush br shadow br hilight br hilight create solid brush get sys color color btnhilight br shadow create solid brush get sys color color btnshadow c brush p old brush dc select object br hilight dc bit blt 0 0 n width n height ddc 0 0 0x00e20746l drawdc bit blt nx dest 1 ny dest 1 n width n height dc 0 0 srccopy dc bit blt 1 1 n width n height ddc 0 0 0x00e20746l dc select object br shadow dc bit blt 0 0 n width n height ddc 0 0 0x00e20746l drawdc bit blt nx dest ny dest n width n height dc 0 0 srccopy reset d cs ddc select object pddc old bmp ddc deletedc dc select object p old brush dc select object pdc old bmp dc deletedc br shadow delete object br hilight delete object bwbmp delete object createcompatibledc cbitmap createcompatiblebitmap nwidth nheight cbitmap pddcoldbmp selectobject createcompatibledc cbitmap pdcoldbmp selectobject patblt nwidth nheight setbkcolor getsyscolor color_btnface bitblt nwidth nheight nxsrc nysrc setbkcolor getsyscolor color_btnhilight bitblt nwidth nheight nxsrc nysrc fillsolidrect nwidth nheight setbkcolor settextcolor cbrush brshadow brhilight brhilight createsolidbrush getsyscolor color_btnhilight brshadow createsolidbrush getsyscolor color_btnshadow cbrush poldbrush selectobject brhilight bitblt nwidth nheight bitblt nxdest nydest nwidth nheight bitblt nwidth nheight selectobject brshadow bitblt nwidth nheight bitblt nxdest nydest nwidth nheight dcs selectobject pddcoldbmp selectobject poldbrush selectobject pdcoldbmp brshadow deleteobject brhilight deleteobject deleteobject int n height c bitmap bmp colorref bgcolor get disabled bitmap bmp bgcolor cdc dc dc create compatibledc null c bitmap pdc old bmp dc select object bmp drawdc bit blt nx dest ny dest n width n height dc 0 0 srccopy reset d cs dc select object pdc old bmp dc deletedc nheight cbitmap getdisabledbitmap createcompatibledc cbitmap pdcoldbmp selectobject bitblt nxdest nydest nwidth nheight dcs selectobject pdcoldbmp bool bc menu get bitmap from image list cdc pdc c image list imglist int n index c bitmap bmp hicon h icon imglist extract icon n index cdc dc dc create compatibledc pdc bmp create compatible bitmap pdc m iconx m icony c bitmap p old bmp dc select object bmp c brush brush colorref m newclrback m newclrback get sys color color 3dface brush create solid brush m newclrback draw icon ex dc get safe hdc 0 0 h icon m iconx m icony 0 hbrush brush di normal dc select object p old bmp dc deletedc the icon is not longer needed destroy icon h icon return true bcmenu getbitmapfromimagelist cimagelist nindex cbitmap hicon extracticon nindex createcompatibledc createcompatiblebitmap m_iconx m_icony cbitmap poldbmp selectobject cbrush m_newclrback m_newclrback getsyscolor color_3dface createsolidbrush m_newclrback drawiconex getsafehdc hicon m_iconx m_icony di_normal selectobject poldbmp destroyicon hicon bool bc menu image list duplicate c image list il int xoffset c image list newlist if il null newlist null xoffset 0 return false hicon h icon il extract icon xoffset int cx cy imagelist geticonsize il m himagelist cx cy newlist create cx cy ilc colorddb ilc mask 1 1 newlist add h icon destroy icon h icon if is luna menu style xp draw 3d bitmaps c wnd p wnd afx get main wnd get main window if p wnd null p wnd c wnd get desktop window cdc pdc p wnd getdc get device context c bitmap bmp bmp2 bmp3 get bitmap from image list pdc newlist 0 bmp get faded bitmap bmp newlist add bmp get sys color color 3dface get bitmap from image list pdc newlist 0 bmp2 get shadow bitmap bmp2 newlist add bmp2 get sys color color 3dface get bitmap from image list pdc newlist 0 bmp3 get disabled bitmap bmp3 newlist add bmp3 get sys color color 3dface p wnd releasedc pdc release the dc return true bcmenu imagelistduplicate cimagelist cimagelist hicon extracticon imagelist_geticonsize m_himagelist ilc_colorddb ilc_mask hicon destroyicon hicon islunamenustyle xp_draw_3d_bitmaps cwnd pwnd afxgetmainwnd pwnd pwnd cwnd getdesktopwindow pwnd cbitmap getbitmapfromimagelist getfadedbitmap getsyscolor color_3dface getbitmapfromimagelist getshadowbitmap getsyscolor color_3dface getbitmapfromimagelist getdisabledbitmap getsyscolor color_3dface pwnd word bc menu num bitmap colors lpbitmapinfoheader lp bitmap if lp bitmap bi clr used 0 return word lp bitmap bi clr used switch lp bitmap bi bit count case 1 return 2 case 4 return 16 case 8 return 256 default return 0 return 0 bcmenu numbitmapcolors lpbitmap lpbitmap biclrused lpbitmap biclrused lpbitmap bibitcount void bc menu color bitmap cdc pdc c bitmap bmp c size bitmap size c size icon size colorref fill colorref border int hatchstyle cdc bmpdc colorref m newclrback int x1 0 y1 0 x2 bitmap size cx y2 bitmap size cy if is winxp luna m newclrback get sys color color 3dface else m newclrback get sys color color menu bmpdc create compatibledc pdc bmp create compatible bitmap pdc icon size cx icon size cy c bitmap p old bitmap bmpdc select object bmp if bitmap size icon size c brush background brush background brush create solid brush m newclrback c rect rect 0 0 icon size cx icon size cy bmpdc fill rect rect background brush x1 icon size cx bitmap size cx 2 y1 icon size cy bitmap size cy 2 x2 x1 bitmap size cx y2 y1 bitmap size cy background brush delete object c pen border pen ps solid 1 border c brush fill brush if hatchstyle 1 fill brush create hatch brush hatchstyle fill else fill brush create solid brush fill c pen p old pen bmpdc select object border pen c brush p old brush bmpdc select object fill brush bmpdc rectangle x1 y1 x2 y2 if null p old brush bmpdc select object p old brush if null p old pen bmpdc select object p old pen if null p old bitmap bmpdc select object p old bitmap bcmenu colorbitmap cbitmap csize bitmap_size csize icon_size m_newclrback bitmap_size bitmap_size iswinxpluna m_newclrback getsyscolor color_3dface m_newclrback getsyscolor color_menu createcompatibledc createcompatiblebitmap icon_size icon_size cbitmap poldbitmap selectobject bitmap_size icon_size cbrush background_brush background_brush createsolidbrush m_newclrback crect icon_size icon_size fillrect background_brush icon_size bitmap_size icon_size bitmap_size bitmap_size bitmap_size background_brush deleteobject cpen border_pen ps_solid cbrush fill_brush fill_brush createhatchbrush fill_brush createsolidbrush cpen poldpen selectobject border_pen cbrush poldbrush selectobject fill_brush poldbrush selectobject poldbrush poldpen selectobject poldpen poldbitmap selectobject poldbitmap void bc menu remove top level owner draw void c string str int i 0 j 0 int nummenulist m menulist get size menustart menustart get menu start for i menustart j 0 i int get menu item count i j if j nummenulist str m menulist j get string if get sub menu i m menulist j n flags mf popup mf byposition modify menu i mf popup mf byposition uint get sub menu i m hmenu str bcmenu removetoplevelownerdraw cstring m_menulist getsize getmenustart getmenuitemcount m_menulist getstring getsubmenu m_menulist nflags mf_popup mf_byposition modifymenu mf_popup mf_byposition getsubmenu m_hmenu int bc menu get menu start void if m loadmenu return 0 c string name str int menuloc 1 listloc 1 menustart 0 i 0 j 0 int nummenulist m menulist get size int nummenu int get menu item count while i nummenu menuloc 1 get menu string i name mf byposition if name get length 0 for j 0 j nummenulist j str m menulist j get string if name str menuloc i listloc j break i if menuloc 0 listloc 0 menuloc listloc menustart menuloc listloc return menustart bcmenu getmenustart m_loadmenu cstring m_menulist getsize getmenuitemcount getmenustring mf_byposition getlength m_menulist getstring void bc menu get faded bitmap c bitmap bmp cdc ddc colorref bgcol col bitmap bit map bmp get bitmap bit map ddc create compatibledc null c bitmap pddc old bmp ddc select object bmp use this to get the background color takes into account color shifting cdc ddc2 c brush brush c bitmap bmp2 ddc2 create compatibledc null bmp2 create compatible bitmap ddc bit map bm width bit map bm height col get sys color color 3dface brush create solid brush col c bitmap pddc old bmp2 ddc2 select object bmp2 c rect rect 0 0 bit map bm width bit map bm height ddc2 fill rect rect brush bgcol ddc2 get pixel 1 1 brush delete object ddc2 select object pddc old bmp2 for int i 0 i bit map bm width i for int j 0 j bit map bm height j col ddc get pixel i j if col bgcol ddc set pixel i j lighten color col 0 3 ddc select object pddc old bmp bcmenu getfadedbitmap cbitmap bitmap getbitmap bitmap createcompatibledc cbitmap pddcoldbmp selectobject cbrush cbitmap createcompatibledc createcompatiblebitmap bitmap bmwidth bitmap bmheight getsyscolor color_3dface createsolidbrush cbitmap pddcoldbmp2 selectobject crect bitmap bmwidth bitmap bmheight fillrect getpixel deleteobject selectobject pddcoldbmp2 bitmap bmwidth bitmap bmheight getpixel setpixel lightencolor selectobject pddcoldbmp void bc menu get transparent bitmap c bitmap bmp cdc ddc colorref bgcol col newcol bitmap bit map bmp get bitmap bit map ddc create compatibledc null c bitmap pddc old bmp ddc select object bmp use this to get the background color takes into account color shifting cdc ddc2 c brush brush c bitmap bmp2 ddc2 create compatibledc null bmp2 create compatible bitmap ddc bit map bm width bit map bm height col rgb 192 192 192 brush create solid brush col c bitmap pddc old bmp2 ddc2 select object bmp2 c rect rect 0 0 bit map bm width bit map bm height ddc2 fill rect rect brush bgcol ddc2 get pixel 1 1 brush delete object ddc2 select object pddc old bmp2 newcol get sys color color 3dface for int i 0 i bit map bm width i for int j 0 j bit map bm height j col ddc get pixel i j if col bgcol ddc set pixel i j newcol ddc select object pddc old bmp bcmenu gettransparentbitmap cbitmap bitmap getbitmap bitmap createcompatibledc cbitmap pddcoldbmp selectobject cbrush cbitmap createcompatibledc createcompatiblebitmap bitmap bmwidth bitmap bmheight createsolidbrush cbitmap pddcoldbmp2 selectobject crect bitmap bmwidth bitmap bmheight fillrect getpixel deleteobject selectobject pddcoldbmp2 getsyscolor color_3dface bitmap bmwidth bitmap bmheight getpixel setpixel selectobject pddcoldbmp void bc menu get disabled bitmap c bitmap bmp colorref background cdc ddc colorref bgcol col discol bitmap bit map bmp get bitmap bit map ddc create compatibledc null c bitmap pddc old bmp ddc select object bmp use this to get the background color takes into account color shifting cdc ddc2 c brush brush c bitmap bmp2 ddc2 create compatibledc null bmp2 create compatible bitmap ddc bit map bm width bit map bm height col get sys color color 3dface brush create solid brush col c bitmap pddc old bmp2 ddc2 select object bmp2 c rect rect 0 0 bit map bm width bit map bm height ddc2 fill rect rect brush bgcol ddc2 get pixel 1 1 brush delete object ddc2 select object pddc old bmp2 discol get sys color color btnshadow for int i 0 i bit map bm width i for int j 0 j bit map bm height j col ddc get pixel i j if col bgcol byte r getr value col byte g getg value col byte b getb value col int avgcol r g b 3 double factor avgcol 255 0 ddc set pixel i j lighten color discol factor else if background ddc set pixel i j background ddc select object pddc old bmp bcmenu getdisabledbitmap cbitmap bitmap getbitmap bitmap createcompatibledc cbitmap pddcoldbmp selectobject cbrush cbitmap createcompatibledc createcompatiblebitmap bitmap bmwidth bitmap bmheight getsyscolor color_3dface createsolidbrush cbitmap pddcoldbmp2 selectobject crect bitmap bmwidth bitmap bmheight fillrect getpixel deleteobject selectobject pddcoldbmp2 getsyscolor color_btnshadow bitmap bmwidth bitmap bmheight getpixel getrvalue getgvalue getbvalue setpixel lightencolor setpixel selectobject pddcoldbmp void bc menu get shadow bitmap c bitmap bmp cdc ddc colorref bgcol col shadowcol get sys color color btnshadow bitmap bit map if is winxp luna shadowcol lighten color shadowcol 0 49 bmp get bitmap bit map ddc create compatibledc null c bitmap pddc old bmp ddc select object bmp use this to get the background color takes into account color shifting cdc ddc2 c brush brush c bitmap bmp2 ddc2 create compatibledc null bmp2 create compatible bitmap ddc bit map bm width bit map bm height col get sys color color 3dface brush create solid brush col c bitmap pddc old bmp2 ddc2 select object bmp2 c rect rect 0 0 bit map bm width bit map bm height ddc2 fill rect rect brush bgcol ddc2 get pixel 1 1 brush delete object ddc2 select object pddc old bmp2 for int i 0 i bit map bm width i for int j 0 j bit map bm height j col ddc get pixel i j if col bgcol ddc set pixel i j shadowcol ddc select object pddc old bmp bcmenu getshadowbitmap cbitmap getsyscolor color_btnshadow bitmap iswinxpluna lightencolor getbitmap bitmap createcompatibledc cbitmap pddcoldbmp selectobject cbrush cbitmap createcompatibledc createcompatiblebitmap bitmap bmwidth bitmap bmheight getsyscolor color_3dface createsolidbrush cbitmap pddcoldbmp2 selectobject crect bitmap bmwidth bitmap bmheight fillrect getpixel deleteobject selectobject pddcoldbmp2 bitmap bmwidth bitmap bmheight getpixel setpixel selectobject pddcoldbmp int bc menu add to global image list c image list il int xoffset int nid int loc 1 himagelist h image list m allimages m himagelist if h image list m allimages create m iconx m icony ilc colorddb ilc mask 1 1 hicon h icon il extract icon xoffset if h icon c bitmap bmp bmp2 bmp3 if is luna menu style xp draw 3d bitmaps c wnd p wnd afx get main wnd get main window if p wnd null p wnd c wnd get desktop window cdc pdc p wnd getdc get device context get bitmap from image list pdc il xoffset bmp get faded bitmap bmp get bitmap from image list pdc il xoffset bmp2 get shadow bitmap bmp2 get bitmap from image list pdc il xoffset bmp3 get disabled bitmap bmp3 p wnd releasedc pdc release the dc int numcurrent m allimagesid get size int existsloc 1 for int i 0 i numcurrent i if m allimagesid i nid existsloc i break if existsloc 0 m allimages replace existsloc h icon loc existsloc if is luna menu style xp draw 3d bitmaps if existsloc 1 numcurrent m allimagesid existsloc 1 nid if existsloc 2 numcurrent m allimagesid existsloc 2 nid c image list il2 il2 create m iconx m icony ilc colorddb ilc mask 1 1 il2 add bmp get sys color color 3dface hicon h icon2 il2 extract icon 0 m allimages replace existsloc 1 h icon2 il2 add bmp2 get sys color color 3dface hicon h icon3 il2 extract icon 1 m allimages replace existsloc 2 h icon3 il2 add bmp3 get sys color color 3dface hicon h icon4 il2 extract icon 2 m allimages replace existsloc 3 h icon4 destroy icon h icon2 destroy icon h icon3 destroy icon h icon4 else m allimages add h icon m allimagesid add nid loc numcurrent if is luna menu style xp draw 3d bitmaps m allimages add bmp get sys color color 3dface m allimages add bmp2 get sys color color 3dface m allimages add bmp3 get sys color color 3dface m allimagesid add nid m allimagesid add nid m allimagesid add nid destroy icon h icon return loc bcmenu addtoglobalimagelist cimagelist himagelist m_allimages m_himagelist himagelist m_allimages m_iconx m_icony ilc_colorddb ilc_mask hicon extracticon hicon cbitmap islunamenustyle xp_draw_3d_bitmaps cwnd pwnd afxgetmainwnd pwnd pwnd cwnd getdesktopwindow pwnd getbitmapfromimagelist getfadedbitmap getbitmapfromimagelist getshadowbitmap getbitmapfromimagelist getdisabledbitmap pwnd m_allimagesid getsize m_allimagesid m_allimages hicon islunamenustyle xp_draw_3d_bitmaps m_allimagesid m_allimagesid cimagelist m_iconx m_icony ilc_colorddb ilc_mask getsyscolor color_3dface hicon2 extracticon m_allimages hicon2 getsyscolor color_3dface hicon3 extracticon m_allimages hicon3 getsyscolor color_3dface hicon4 extracticon m_allimages hicon4 destroyicon hicon2 destroyicon hicon3 destroyicon hicon4 m_allimages hicon m_allimagesid islunamenustyle xp_draw_3d_bitmaps m_allimages getsyscolor color_3dface m_allimages getsyscolor color_3dface m_allimages getsyscolor color_3dface m_allimagesid m_allimagesid m_allimagesid destroyicon hicon int bc menu global image list offset int nid int numcurrent m allimagesid get size int existsloc 1 for int i 0 i numcurrent i if m allimagesid i nid existsloc i break return existsloc bcmenu globalimagelistoffset m_allimagesid getsize m_allimagesid bool bc menu can draw3d image list int offset bool retflag false int numcurrent m allimagesid get size if offset 1 numcurrent offset 2 numcurrent int nid m allimagesid offset if m allimagesid offset 1 nid m allimagesid offset 2 nid retflag true return retflag bcmenu candraw3dimagelist m_allimagesid getsize m_allimagesid m_allimagesid m_allimagesid bc menu memdc cdc pdc lpcrect lp src rect cdc assert pdc null m rect copy rect lp src rect m pdc pdc m poldbitmap null m bmemdc pdc is printing if m bmemdc create a memory dc create compatibledc pdc m bitmap create compatible bitmap pdc m rect width m rect height m poldbitmap select object m bitmap set window org m rect left m rect top else make a copy of the relevent parts of the current dc for printing m bprinting pdc m bprinting m hdc pdc m hdc m hattribdc pdc m hattribdc bcmenumemdc lpsrcrect m_rect copyrect lpsrcrect m_pdc m_poldbitmap m_bmemdc isprinting m_bmemdc createcompatibledc m_bitmap createcompatiblebitmap m_rect m_rect m_poldbitmap selectobject m_bitmap setwindoworg m_rect m_rect m_bprinting m_bprinting m_hdc m_hdc m_hattribdc m_hattribdc bc menu memdc if m bmemdc copy the offscreen bitmap onto the screen m pdc bit blt m rect left m rect top m rect width m rect height this m rect left m rect top srccopy swap back the original bitmap select object m poldbitmap else all we need to do is replace the dc with an illegal value this keeps us from accidently deleting the handles associated with the cdc that was passed to the constructor m hdc m hattribdc null bcmenumemdc m_bmemdc m_pdc bitblt m_rect m_rect m_rect m_rect m_rect m_rect selectobject m_poldbitmap m_hdc m_hattribdc bc menu memdc cdc pdc lpcrect lp src rect cdc assert pdc null m rect copy rect lp src rect m pdc pdc m poldbitmap null m bmemdc pdc is printing if m bmemdc create a memory dc create compatibledc pdc m bitmap create compatible bitmap pdc m rect width m rect height m poldbitmap select object m bitmap set window org m rect left m rect top else make a copy of the relevent parts of the current dc for printing m bprinting pdc m bprinting m hdc pdc m hdc m hattribdc pdc m hattribdc bcmenumemdc lpsrcrect m_rect copyrect lpsrcrect m_pdc m_poldbitmap m_bmemdc isprinting m_bmemdc createcompatibledc m_bitmap createcompatiblebitmap m_rect m_rect m_poldbitmap selectobject m_bitmap setwindoworg m_rect m_rect m_bprinting m_bprinting m_hdc m_hdc m_hattribdc m_hattribdc c main frame c main frame m bfontspecified false m strsaveaspath t m bfirsttime true m bautomaticrescan the app get profile int t settings t automatic rescan true 0 m bignoreblanklines the app get profile int t settings t ignore blank lines false 0 m beolsensitive the app get profile int t settings t eol sensitive false 0 m bignorecase the app get profile int t settings t ignore case false 0 m bshowuniqueleft the app get profile int t settings t show unique left true 0 m bshowuniqueright the app get profile int t settings t show unique right true 0 m bshowdiff the app get profile int t settings t show different true 0 m bshowident the app get profile int t settings t show identical true 0 m bshowbinaries the app get profile int t settings t show binaries true 0 m bbackup the app get profile int t settings t backup file true 0 m bviewwhitespace the app get profile int t settings t view whitespace false 0 m bscrolltofirst the app get profile int t settings t scroll to first false 0 m nignorewhitespace the app get profile int t settings t ignore space 1 m bhidebak the app get profile int t settings t hide bak true 0 m nversys the app get profile int t settings t version system 0 m strvssproject the app get profile string t settings t vss project t m strvssuser the app get profile string t settings t vss user t m strvsspassword the app get profile string t settings t vss password t m strvsspath the app get profile string t settings t vss path t m ntabsize the app get profile int t settings t tab size 4 m ntabtype the app get profile int t settings t tab type 0 m bignoreregexp the app get profile int t settings t ignore reg exp false m spattern the app get profile string t settings t reg exps null the app set file filter path the app get profile string t settings t file filter path t m breusedirdoc true todo read preference for logging if m strvsspath is empty c reg key ex reg if reg open hkey local machine t software microsoft source safe error success tchar temp max path 0 reg read chars t scc server path temp max path t c string spath get path only temp m strvsspath spath t ss exe cmainframe cmainframe m_bfontspecified m_strsaveaspath _t m_bfirsttime m_bautomaticrescan theapp getprofileint _t _t automaticrescan m_bignoreblanklines theapp getprofileint _t _t ignoreblanklines m_beolsensitive theapp getprofileint _t _t eolsensitive m_bignorecase theapp getprofileint _t _t ignorecase m_bshowuniqueleft theapp getprofileint _t _t showuniqueleft m_bshowuniqueright theapp getprofileint _t _t showuniqueright m_bshowdiff theapp getprofileint _t _t showdifferent m_bshowident theapp getprofileint _t _t showidentical m_bshowbinaries theapp getprofileint _t _t showbinaries m_bbackup theapp getprofileint _t _t backupfile m_bviewwhitespace theapp getprofileint _t _t viewwhitespace m_bscrolltofirst theapp getprofileint _t _t scrolltofirst m_nignorewhitespace theapp getprofileint _t _t ignorespace m_bhidebak theapp getprofileint _t _t hidebak m_nversys theapp getprofileint _t _t versionsystem m_strvssproject theapp getprofilestring _t _t vssproject _t m_strvssuser theapp getprofilestring _t _t vssuser _t m_strvsspassword theapp getprofilestring _t _t vsspassword _t m_strvsspath theapp getprofilestring _t _t vsspath _t m_ntabsize theapp getprofileint _t _t tabsize m_ntabtype theapp getprofileint _t _t tabtype m_bignoreregexp theapp getprofileint _t _t ignoreregexp m_spattern theapp getprofilestring _t _t regexps theapp setfilefilterpath theapp getprofilestring _t _t filefilterpath _t m_breusedirdoc m_strvsspath isempty cregkeyex hkey_local_machine _t sourcesafe error_success _max_path readchars _t sccserverpath _max_path _t cstring getpathonly m_strvsspath _t bool c main frame delete file or error lpctstr sz file if delete file sz file c string s error get system error desc get last error remove line returns s error s error c string t sz file t c string s afx format string1 s ids delete file failed s error afx message box s mb ok mb iconstop return false return true cmainframe deletefileorerror szfile deletefile szfile cstring serror getsystemerrordesc getlasterror removelinereturns serror serror cstring _t szfile _t cstring afxformatstring1 ids_delete_file_failed serror afxmessagebox mb_ok mb_iconstop void c main frame rpt status byte code switch code case file same m nstatusfilesame break case file binsame m nstatusfilebinsame break case file diff m nstatusfilediff break case file bindiff m nstatusfilebindiff break case file error m nstatusfileerror break case file lunique m nstatusleftfileonly break case file ldirunique m nstatusleftdironly break case file runique m nstatusrightfileonly break case file rdirunique m nstatusrightdironly break c string s todo load the format string from resource s format t s d bs d d d bd d lf d ld d rf d rd d e d m nstatusfilesame m nstatusfilebinsame m nstatusfilediff m nstatusfilebindiff m nstatusleftfileonly m nstatusleftdironly m nstatusrightfileonly m nstatusrightdironly m nstatusfileerror m wndstatusbar set pane text 2 s cmainframe rptstatus file_same m_nstatusfilesame file_binsame m_nstatusfilebinsame file_diff m_nstatusfilediff file_bindiff m_nstatusfilebindiff file_error m_nstatusfileerror file_lunique m_nstatusleftfileonly file_ldirunique m_nstatusleftdironly file_runique m_nstatusrightfileonly file_rdirunique m_nstatusrightdironly cstring _t m_nstatusfilesame m_nstatusfilebinsame m_nstatusfilediff m_nstatusfilebindiff m_nstatusleftfileonly m_nstatusleftdironly m_nstatusrightfileonly m_nstatusrightdironly m_nstatusfileerror m_wndstatusbar setpanetext void c main frame clear status m nstatusfilesame m nstatusfilebinsame m nstatusfilediff m nstatusfilebindiff m nstatusfileerror m nstatusleftfileonly m nstatusleftdironly m nstatusrightfileonly m nstatusrightdironly 0 cmainframe clearstatus m_nstatusfilesame m_nstatusfilebinsame m_nstatusfilediff m_nstatusfilebindiff m_nstatusfileerror m_nstatusleftfileonly m_nstatusleftdironly m_nstatusrightfileonly m_nstatusrightdironly bool c main frame sync files lpctstr psz src lpctstr psz dest c string ps error if do sync files psz src psz dest ps error c string msg afx format string2 msg ids copy file failed ps error psz src ps error msg return false return true cmainframe syncfiles pszsrc pszdest cstring pserror dosyncfiles pszsrc pszdest pserror cstring afxformatstring2 ids_copy_file_failed pserror pszsrc pserror bool c main frame do sync files lpctstr psz src lpctstr psz dest c string ps error c string s action error c string str save path psz dest if check save path str save path ps error load string ids error file writeable return false if create backup str save path ps error load string ids error backup return false now it s just a matter of copying the right file to the left delete file str save path errors are handled from copy file below if copy file psz src str save path false ps error get system error desc get last error return false tell the dir view to update itself return true cmainframe dosyncfiles pszsrc pszdest cstring pserror cstring sactionerror cstring strsavepath pszdest checksavepath strsavepath pserror loadstring ids_error_file_writeable createbackup strsavepath pserror loadstring ids_error_backup deletefile strsavepath copyfile copyfile pszsrc strsavepath pserror getsystemerrordesc getlasterror void c main frame update current file status c dir doc p dir doc uint n status int idx assert p dir doc c dir view pv p dir doc get main view assert pv first change it in the dirlist position diffpos pv get item key idx todo why is the update broken into these pieces someone could figure out these pieces and probably simplify this update diffitem code p dir doc m pctxt update status code diffpos byte n status update diffitem time and also tell views p dir doc update item status idx m pdirdoc redisplay cmainframe updatecurrentfilestatus cdirdoc pdirdoc nstatus pdirdoc cdirview pdirdoc getmainview getitemkey pdirdoc m_pctxt updatestatuscode nstatus pdirdoc updateitemstatus m_pdirdoc dword dw left flags 0 dword dw right flags 0 bool b recurse false c string str left psz left c string str right psz right c string str ext bool doc null c dir doc p dir doc get dir doc to show doc null if doc null if reusing an existing doc give it a chance to save its data and close any merge views and clear its window if p dir doc reusing dir doc return false pop up dialog unless arguments exist and are compatible path existence paths type get pair comparability psz left psz right if paths type does not exist c open dlg dlg dlg m strleft str left dlg m strright str right dlg m brecurse b recurse if dlg do modal idok return false str left dlg m strleft str right dlg m strright b recurse dlg m brecurse str ext dlg m strparsedext paths type static cast path existence dlg m pathstype else save the mru left and right files if dw left flags ffileopen nomru add to mru psz left t files left if dw right flags ffileopen nomru add to mru psz right t files right if 1 g log write t begin comparison parameters r n t t left s r n t t right s r n t t recurse d r n t t show unique left d r n t t show unique right d r n t t show identical d r n t t show diff d r n t t show binaries d r n t t hide bak d r n t t ver sys d r n t t vss path s r n t t backups d r n t t ignorews d r n t t scroll to first d r n t end comparison parameters r n str left str right b recurse m bshowuniqueleft m bshowuniqueright m bshowident m bshowdiff m bshowbinaries m bhidebak m nversys m strvsspath m bbackup m nignorewhitespace m bscrolltofirst open the diff if paths type is existing dir recursive b recurse if p dir doc c diff context p ctxt new c diff context str left str right if p ctxt null p dir doc set diff context p ctxt p ctxt set reg exp str ext p dir doc rescan if m bscrolltofirst c dir view p dir view p dir doc get main view p dir view goto first diff else recursive false show merge doc p dir doc str left str right return true dwleftflags dwrightflags brecurse cstring strleft pszleft cstring strright pszright cstring strext docnull cdirdoc pdirdoc getdirdoctoshow docnull docnull pdirdoc reusingdirdoc path_existence pathstype getpaircomparability pszleft pszright pathstype does_not_exist copendlg m_strleft strleft m_strright strright m_brecurse brecurse domodal strleft m_strleft strright m_strright brecurse m_brecurse strext m_strparsedext pathstype static_cast path_existence m_pathstype dwleftflags ffileopen_nomru addtomru pszleft _t dwrightflags ffileopen_nomru addtomru pszright _t glog _t _t tleft _t tright _t trecurse _t tshowuniqueleft _t tshowuniqueright _t tshowidentical _t tshowdiff _t tshowbinaries _t thidebak _t tversys _t tvsspath _t tbackups _t tignorews _t tscrolltofirst _t strleft strright brecurse m_bshowuniqueleft m_bshowuniqueright m_bshowident m_bshowdiff m_bshowbinaries m_bhidebak m_nversys m_strvsspath m_bbackup m_nignorewhitespace m_bscrolltofirst pathstype is_existing_dir brecurse pdirdoc cdiffcontext pctxt cdiffcontext strleft strright pctxt pdirdoc setdiffcontext pctxt pctxt setregexp strext pdirdoc m_bscrolltofirst cdirview pdirview pdirdoc getmainview pdirview gotofirstdiff showmergedoc pdirdoc strleft strright void c main frame show merge doc c dir doc p dir doc lpctstr sz left lpctstr sz right c string s error bool doc null int n rescan result rescan ok c merge doc p merge doc get merge doc to show p dir doc doc null assert p merge doc must assert to get an answer to the question below if p merge doc return when does this happen c child frame pf p merge doc get parent frame assert pf p merge doc m strleftfile sz left p merge doc m strrightfile sz right p merge doc m ltbuf free all p merge doc m rtbuf free all p merge doc m ltbuf set eol sensitivity m beolsensitive p merge doc m rtbuf set eol sensitivity m beolsensitive load left side int n left success p merge doc m ltbuf load from file sz left if n left success fresult ok p merge doc m ltbuf init new if n left success fresult error afx format string1 s error ids error file not found sz left else if n left success fresult binary s error load string ids filebinary s error n s error sz left s error int n right success fresult error load right side only if left side was succesfully loaded if n left success fresult ok n right success p merge doc m rtbuf load from file sz right if left side failed we must init rightside buffer too if n left success fresult ok n right success fresult ok p merge doc m rtbuf init new left side was ok but right side failed else if n left success fresult ok n right success fresult ok p merge doc m rtbuf init new if n right success fresult error afx format string1 s error ids error file not found sz right else if n right success fresult binary s error load string ids filebinary s error n s error sz right s error bail out if either side failed if s error is empty afx message box s error mb ok mb iconstop p merge doc get parent frame destroy window return n rescan result p merge doc rescan if n rescan result rescan ok if doc null c wnd p wnd p merge doc get parent frame mdi activate p wnd else mdi next c merge edit view p left p merge doc get left view c merge edit view p right p merge doc get right view scroll to first diff if m bscrolltofirst p merge doc m diffs get size 0 p left select diff 0 true false enable disable automatic rescan rescanning after edit p left enable rescan m bautomaticrescan p right enable rescan m bautomaticrescan set the document types c string sext split filename sz left 0 0 sext p left set text type sext split filename sz right 0 0 sext p right set text type sext set text type will revert to language dependent defaults for tab p left set tab size mf m ntabsize p right set tab size mf m ntabsize p left set view tabs mf m bviewwhitespace p right set view tabs mf m bviewwhitespace enable backspace at beginning of line p left set disablebs atsol false p right set disablebs atsol false set the frame window header pf set header text 0 sz left pf set header text 1 sz right set tab type tabs spaces bool b insert tabs m ntabtype 0 p left set insert tabs b insert tabs p right set insert tabs b insert tabs else c merge doc rescan fails if files are identical or does not exist on both sides or the really arcane case that the temp files couldn t be created which is too obscure to bother reporting if you can t write to your temp directory doing nothing is graceful enough for that p merge doc show rescan error n rescan result p merge doc get parent frame destroy window cmainframe showmergedoc cdirdoc pdirdoc szleft szright cstring serror docnull nrescanresult rescan_ok cmergedoc pmergedoc getmergedoctoshow pdirdoc docnull pmergedoc pmergedoc cchildframe pmergedoc getparentframe pmergedoc m_strleftfile szleft pmergedoc m_strrightfile szright pmergedoc m_ltbuf freeall pmergedoc m_rtbuf freeall pmergedoc m_ltbuf seteolsensitivity m_beolsensitive pmergedoc m_rtbuf seteolsensitivity m_beolsensitive nleftsuccess pmergedoc m_ltbuf loadfromfile szleft nleftsuccess fresult_ok pmergedoc m_ltbuf initnew nleftsuccess fresult_error afxformatstring1 serror ids_error_file_not_found szleft nleftsuccess fresult_binary serror loadstring ids_filebinary serror serror szleft serror nrightsuccess fresult_error nleftsuccess fresult_ok nrightsuccess pmergedoc m_rtbuf loadfromfile szright nleftsuccess fresult_ok nrightsuccess fresult_ok pmergedoc m_rtbuf initnew nleftsuccess fresult_ok nrightsuccess fresult_ok pmergedoc m_rtbuf initnew nrightsuccess fresult_error afxformatstring1 serror ids_error_file_not_found szright nrightsuccess fresult_binary serror loadstring ids_filebinary serror serror szright serror serror isempty afxmessagebox serror mb_ok mb_iconstop pmergedoc getparentframe destroywindow nrescanresult pmergedoc nrescanresult rescan_ok docnull cwnd pwnd pmergedoc getparentframe mdiactivate pwnd mdinext cmergeeditview pleft pmergedoc getleftview cmergeeditview pright pmergedoc getrightview m_bscrolltofirst pmergedoc m_diffs getsize pleft selectdiff pleft enablerescan m_bautomaticrescan pright enablerescan m_bautomaticrescan cstring splitfilename szleft pleft settexttype splitfilename szright pright settexttype settexttype pleft settabsize m_ntabsize pright settabsize m_ntabsize pleft setviewtabs m_bviewwhitespace pright setviewtabs m_bviewwhitespace pleft setdisablebsatsol pright setdisablebsatsol setheadertext szleft setheadertext szright binserttabs m_ntabtype pleft setinserttabs binserttabs pright setinserttabs binserttabs cmergedoc pmergedoc showrescanerror nrescanresult pmergedoc getparentframe destroywindow void c main frame update resources m wndstatusbar set pane text 0 load res string afx ids idlemessage dir doc list dirdocs get all dir docs dirdocs while dirdocs is empty c dir doc p doc dirdocs remove head p doc update resources merge doc list mergedocs get all merge docs mergedocs while mergedocs is empty c merge doc p doc mergedocs remove head p doc get left view update resources p doc get right view update resources cmainframe updateresources m_wndstatusbar setpanetext loadresstring afx_ids_idlemessage dirdoclist getalldirdocs isempty cdirdoc pdoc removehead pdoc updateresources mergedoclist getallmergedocs isempty cmergedoc pdoc removehead pdoc getleftview updateresources pdoc getrightview updateresources hmenu c main frame new default menu m default load menu idr mainframe m default load toolbar idr mainframe return m default detach cmainframe newdefaultmenu m_default loadmenu idr_mainframe m_default loadtoolbar idr_mainframe m_default bool c main frame create backup lpctstr psz path first make a backup copy of the original c file status status create backup copy of file if destination file exists if m bbackup c file get status psz path status build the backup filename c string spath sname sext split filename psz path spath sname sext c string s if sext is empty s format t s s s backup file ext spath sname sext else s format t s s backup file ext spath sname get rid of the dest file delete file s errors are handled from move file below move the sucker if move file psz path s afx message box ids backup failed prompt mb yesno mb iconquestion idyes return false return true we got here because we re either not backing up of there was nothing to backup return true cmainframe createbackup pszpath cfilestatus m_bbackup cfile getstatus pszpath cstring splitfilename pszpath cstring isempty _t backup_file_ext _t backup_file_ext deletefile movefile movefile pszpath afxmessagebox ids_backup_failed_prompt mb_yesno mb_iconquestion bool c main frame check save path c string str save path bool need check c file status status c string s check if file is writeable do need check false if c file get status str save path status if status m attribute c file attribute read only int user choice idcancel switch m nversys case 0 no versioning system prompt for user choice afx format string1 s ids savereadonly fmt str save path if afx message box s mb yesno mb iconquestion idyes user choice idsaveas break case 1 visual source safe prompt for user choice c vss prompt dlg dlg m strmessage format message ids save fmt str save path dlg m strproject m strvssproject dlg m struser m strvssuser bsp add vss user name to dialog box dlg m strpassword m strvsspassword user choice dlg do modal process versioning system specific action if user choice idok c wait cursor wait m strvssproject dlg m strproject the app write profile string t settings t vss project mf m strvssproject c string spath sname split filename str save path spath sname 0 if spath is empty chdrive toupper spath 0 a 1 chdir spath c string args args format t checkout s s m strvssproject sname handle h vss run it m strvsspath args true false if h vss invalid handle value wait for single object h vss infinite dword code get exit code process h vss code close handle h vss if code 0 afx message box ids vsserror mb iconstop return false need check false else afx message box ids vss run error mb iconstop return false break case 2 c visual source safe 5 0 com prompt for user choice c vss prompt dlg dlg m strmessage format message ids save fmt str save path dlg m strproject m strvssproject dlg m struser m strvssuser bsp add vss user name to dialog box dlg m strpassword m strvsspassword user choice dlg do modal process versioning system specific action if user choice idok c wait cursor wait m strvssproject dlg m strproject m strvssuser dlg m struser m strvsspassword dlg m strpassword the app write profile string t settings t vss project m strvssproject the app write profile string t settings t vss user m strvssuser the app write profile string t settings t vss password m strvsspassword ivss database vssdb ivss items m vssis ivss item m vssi c ole exception e ole exception new c ole exception bsp create the com interface pointer to vss if failed vssdb create dispatch source safe e ole exception throw e ole exception catch block deletes else e ole exception delete bsp open the specific vss data file using info from vss dialog box vssdb open m strvsspath m strvssuser m strvsspassword c string spath sname split filename str save path spath sname 0 bsp combine the project entered on the dialog box with the file name c string str item m strvssproject sname bsp to get the specific source safe item to be checked out m vssi vssdb getvss item str item 0 bsp get the working directory where vss will put the file c string str local spec m vssi get local spec bsp and compare it to the directory win merge is using if str local spec compare no case str save path bsp if the directories are different let the user confirm the check out int i res afx message box the vss working folder and the location of the current file do not match continue mb yesno if i res idyes return false bsp if not yes bail bsp finally check out the file m vssi checkout str save path 0 break case 3 clear case prompt for user choice ccc prompt dlg user choice dlg do modal process versioning system specific action if user choice idok c wait cursor wait c string spath sname split filename str save path spath sname 0 if spath is empty chdrive toupper spath 0 a 1 chdir spath dword code c string args args format t checkout c s s dlg m comments sname handle h vss run it m strvsspath args true false if h vss invalid handle value wait for single object h vss infinite get exit code process h vss code close handle h vss if code 0 afx message box ids vsserror mb iconstop return false need check false else afx message box ids vss run error mb iconstop return false break switch m nversys common processing for all version systems switch user choice case idcancel return false case idsaveas c string title verify title load string ids save as title if select file s str save path title null false str save path s need check true else return false break while need check return true cmainframe checksavepath cstring strsavepath needcheck cfilestatus cstring needcheck cfile getstatus strsavepath m_attribute cfile readonly userchoice m_nversys afxformatstring1 ids_savereadonly_fmt strsavepath afxmessagebox mb_yesno mb_iconquestion userchoice cvssprompt m_strmessage formatmessage ids_save_fmt strsavepath m_strproject m_strvssproject m_struser m_strvssuser m_strpassword m_strvsspassword userchoice domodal userchoice cwaitcursor m_strvssproject m_strproject theapp writeprofilestring _t _t vssproject m_strvssproject cstring splitfilename strsavepath isempty _chdrive _chdir cstring _t m_strvssproject hvss runit m_strvsspath hvss invalid_handle_value waitforsingleobject hvss getexitcodeprocess hvss closehandle hvss afxmessagebox ids_vsserror mb_iconstop needcheck afxmessagebox ids_vss_run_error mb_iconstop cvisual sourcesafe cvssprompt m_strmessage formatmessage ids_save_fmt strsavepath m_strproject m_strvssproject m_struser m_strvssuser m_strpassword m_strvsspassword userchoice domodal userchoice cwaitcursor m_strvssproject m_strproject m_strvssuser m_struser m_strvsspassword m_strpassword theapp writeprofilestring _t _t vssproject m_strvssproject theapp writeprofilestring _t _t vssuser m_strvssuser theapp writeprofilestring _t _t vsspassword m_strvsspassword ivssdatabase ivssitems m_vssis ivssitem m_vssi coleexception eoleexception coleexception createdispatch sourcesafe eoleexception eoleexception eoleexception m_strvsspath m_strvssuser m_strvsspassword cstring splitfilename strsavepath cstring stritem m_strvssproject m_vssi getvssitem stritem cstring strlocalspec m_vssi getlocalspec winmerge strlocalspec comparenocase strsavepath checkout ires afxmessagebox mb_yesno ires m_vssi strsavepath clearcase cccprompt userchoice domodal userchoice cwaitcursor cstring splitfilename strsavepath isempty _chdrive _chdir cstring _t m_comments hvss runit m_strvsspath hvss invalid_handle_value waitforsingleobject hvss getexitcodeprocess hvss closehandle hvss afxmessagebox ids_vsserror mb_iconstop needcheck afxmessagebox ids_vss_run_error mb_iconstop m_nversys userchoice cstring loadstring ids_save_as_title selectfile strsavepath strsavepath needcheck needcheck c string c main frame set status lpctstr status c string old m wndstatusbar get pane text 0 m wndstatusbar set pane text 0 status return old cstring cmainframe setstatus cstring m_wndstatusbar getpanetext m_wndstatusbar setpanetext bool c main frame pre create window createstruct cs todo modify the window class or styles here by modifying the createstruct cs return cmdi frame wnd pre create window cs cmainframe precreatewindow cmdiframewnd precreatewindow void c main frame activate frame int n cmd show if m bfirsttime cmdi frame wnd activate frame n cmd show return m bfirsttime false windowplacement wp wp length sizeof windowplacement get window placement wp wp rc normal position left the app get profile int t settings t main left 0 wp rc normal position top the app get profile int t settings t main top 0 wp rc normal position right the app get profile int t settings t main right 0 wp rc normal position bottom the app get profile int t settings t main bottom 0 wp show cmd n cmd show c rect dsk rc rc wp rc normal position dsk rc left get system metrics sm xvirtualscreen dsk rc top get system metrics sm yvirtualscreen dsk rc right dsk rc left get system metrics sm cxvirtualscreen dsk rc bottom dsk rc top get system metrics sm cyvirtualscreen if the app get profile int t settings t main max false cmdi frame wnd activate frame sw maximize else if rc width 0 rc height 0 ensure top left corner is on visible area 20 points margin is added to prevent lost window c point pt top left rc top left pt top left c point 20 20 if dsk rc pt in rect pt top left set window placement wp else cmdi frame wnd activate frame n cmd show else cmdi frame wnd activate frame n cmd show cmainframe activateframe ncmdshow m_bfirsttime cmdiframewnd activateframe ncmdshow m_bfirsttime getwindowplacement rcnormalposition theapp getprofileint _t _t mainleft rcnormalposition theapp getprofileint _t _t maintop rcnormalposition theapp getprofileint _t _t mainright rcnormalposition theapp getprofileint _t _t mainbottom showcmd ncmdshow crect dsk_rc rcnormalposition dsk_rc getsystemmetrics sm_xvirtualscreen dsk_rc getsystemmetrics sm_yvirtualscreen dsk_rc dsk_rc getsystemmetrics sm_cxvirtualscreen dsk_rc dsk_rc getsystemmetrics sm_cyvirtualscreen theapp getprofileint _t _t mainmax cmdiframewnd activateframe sw_maximize cpoint pttopleft topleft pttopleft cpoint dsk_rc ptinrect pttopleft setwindowplacement cmdiframewnd activateframe ncmdshow cmdiframewnd activateframe ncmdshow c main frame c main frame destroy the reg expression list free reg exp list cmainframe cmainframe freeregexplist void c main frame get font properties m lfdiff lf height the app get profile int t font t height 16 m lfdiff lf width the app get profile int t font t width 0 m lfdiff lf escapement the app get profile int t font t escapement 0 m lfdiff lf orientation the app get profile int t font t orientation 0 m lfdiff lf weight the app get profile int t font t weight fw normal m lfdiff lf italic byte the app get profile int t font t italic false m lfdiff lf underline byte the app get profile int t font t underline false m lfdiff lf strike out byte the app get profile int t font t strike out false m lfdiff lf char set byte the app get profile int t font t char set ansi charset m lfdiff lf out precision byte the app get profile int t font t out precision out string precis m lfdiff lf clip precision byte the app get profile int t font t clip precision clip stroke precis m lfdiff lf quality byte the app get profile int t font t quality draft quality m lfdiff lf pitch and family byte the app get profile int t font t pitch and family ff modern fixed pitch tcscpy m lfdiff lf face name the app get profile string t font t face name t courier cmainframe getfontproperties m_lfdiff lfheight theapp getprofileint _t _t m_lfdiff lfwidth theapp getprofileint _t _t m_lfdiff lfescapement theapp getprofileint _t _t m_lfdiff lforientation theapp getprofileint _t _t m_lfdiff lfweight theapp getprofileint _t _t fw_normal m_lfdiff lfitalic theapp getprofileint _t _t m_lfdiff lfunderline theapp getprofileint _t _t m_lfdiff lfstrikeout theapp getprofileint _t _t strikeout m_lfdiff lfcharset theapp getprofileint _t _t charset ansi_charset m_lfdiff lfoutprecision theapp getprofileint _t _t outprecision out_string_precis m_lfdiff lfclipprecision theapp getprofileint _t _t clipprecision clip_stroke_precis m_lfdiff lfquality theapp getprofileint _t _t draft_quality m_lfdiff lfpitchandfamily theapp getprofileint _t _t pitchandfamily ff_modern fixed_pitch _tcscpy m_lfdiff lffacename theapp getprofilestring _t _t facename _t void c main frame on options show different m bshowdiff m bshowdiff the app write profile int t settings t show different m bshowdiff redisplay all dir docs cmainframe onoptionsshowdifferent m_bshowdiff m_bshowdiff theapp writeprofileint _t _t showdifferent m_bshowdiff redisplayalldirdocs void c main frame on options show identical m bshowident m bshowident the app write profile int t settings t show identical m bshowident redisplay all dir docs cmainframe onoptionsshowidentical m_bshowident m_bshowident theapp writeprofileint _t _t showidentical m_bshowident redisplayalldirdocs void c main frame on options show unique left m bshowuniqueleft m bshowuniqueleft the app write profile int t settings t show unique left m bshowuniqueleft redisplay all dir docs cmainframe onoptionsshowuniqueleft m_bshowuniqueleft m_bshowuniqueleft theapp writeprofileint _t _t showuniqueleft m_bshowuniqueleft redisplayalldirdocs void c main frame on options show unique right m bshowuniqueright m bshowuniqueright the app write profile int t settings t show unique right m bshowuniqueright redisplay all dir docs cmainframe onoptionsshowuniqueright m_bshowuniqueright m_bshowuniqueright theapp writeprofileint _t _t showuniqueright m_bshowuniqueright redisplayalldirdocs void c main frame on options show binaries m bshowbinaries m bshowbinaries the app write profile int t settings t show binaries m bshowbinaries redisplay all dir docs cmainframe onoptionsshowbinaries m_bshowbinaries m_bshowbinaries theapp writeprofileint _t _t showbinaries m_bshowbinaries redisplayalldirdocs void c main frame on update options showdifferent c cmdui p cmdui p cmdui set check m bshowdiff cmainframe onupdateoptionsshowdifferent ccmdui pcmdui pcmdui setcheck m_bshowdiff void c main frame on update options showidentical c cmdui p cmdui p cmdui set check m bshowident cmainframe onupdateoptionsshowidentical ccmdui pcmdui pcmdui setcheck m_bshowident void c main frame on update options showuniqueleft c cmdui p cmdui p cmdui set check m bshowuniqueleft cmainframe onupdateoptionsshowuniqueleft ccmdui pcmdui pcmdui setcheck m_bshowuniqueleft void c main frame on update options showuniqueright c cmdui p cmdui p cmdui set check m bshowuniqueright cmainframe onupdateoptionsshowuniqueright ccmdui pcmdui pcmdui setcheck m_bshowuniqueright void c main frame on update options show binaries c cmdui p cmdui p cmdui set check m bshowbinaries cmainframe onupdateoptionsshowbinaries ccmdui pcmdui pcmdui setcheck m_bshowbinaries int c main frame on create lpcreatestruct lp create struct if cmdi frame wnd on create lp create struct 1 return 1 mf this ignore space change flag m nignorewhitespace 1 ignore all space flag m nignorewhitespace 2 length varies m nignorewhitespace 0 ignore case flag m bignorecase ignore blank lines flag m bignoreblanklines ignore eol diff m beolsensitive ignore some changes m nignorewhitespace 0 m bignorecase m bignoreblanklines m beolsensitive build the initial reg expression list rebuild reg exp list heuristic 1 output style output normal context 1 line end char n ignore blank lines flag 1 get font properties if m wndtoolbar create ex this tbstyle flat ws child ws visible cbrs gripper cbrs top cbrs tooltips cbrs flyby cbrs size dynamic m wndtoolbar load tool bar idr mainframe trace0 failed to create toolbar n return 1 fail to create if m wndstatusbar create this m wndstatusbar set indicators indicators sizeof indicators sizeof uint trace0 failed to create status bar n return 1 fail to create m wndstatusbar set pane info 1 id diffnum 0 150 m wndstatusbar set pane info 2 id diffstatus 0 250 todo remove this if you don t want tool tips or a resizeable toolbar m wndtoolbar set bar style m wndtoolbar get bar style cbrs tooltips cbrs flyby cbrs size dynamic todo delete these three lines if you don t want the toolbar to be dockable m wndtoolbar enable docking cbrs align any enable docking cbrs align any dock control bar m wndtoolbar cg the following line was added by the splash screen component c splash wnd show splash screen this start handling status messages from wait status cursors my status display set frame this wait status cursor set status display my status display return 0 cmainframe oncreate lpcreatestruct cmdiframewnd oncreate lpcreatestruct ignore_space_change_flag m_nignorewhitespace ignore_all_space_flag m_nignorewhitespace length_varies m_nignorewhitespace ignore_case_flag m_bignorecase ignore_blank_lines_flag m_bignoreblanklines ignore_eol_diff m_beolsensitive ignore_some_changes m_nignorewhitespace m_bignorecase m_bignoreblanklines m_beolsensitive rebuildregexplist output_style output_normal line_end_char ignore_blank_lines_flag getfontproperties m_wndtoolbar createex tbstyle_flat ws_child ws_visible cbrs_gripper cbrs_top cbrs_tooltips cbrs_flyby cbrs_size_dynamic m_wndtoolbar loadtoolbar idr_mainframe m_wndstatusbar m_wndstatusbar setindicators m_wndstatusbar setpaneinfo id_diffnum m_wndstatusbar setpaneinfo id_diffstatus m_wndtoolbar setbarstyle m_wndtoolbar getbarstyle cbrs_tooltips cbrs_flyby cbrs_size_dynamic m_wndtoolbar enabledocking cbrs_align_any enabledocking cbrs_align_any dockcontrolbar m_wndtoolbar csplashwnd showsplashscreen waitstatuscursors mystatusdisplay setframe waitstatuscursor setstatusdisplay mystatusdisplay c menu p menu lresult lresult if m default is menu p menu lresult bc menu find keyboard shortcut n char n flags p menu else lresult cmdi frame wnd on menu char n char n flags p menu return lresult cmenu pmenu m_default ismenu pmenu bcmenu findkeyboardshortcut nchar nflags pmenu cmdiframewnd onmenuchar nchar nflags pmenu void c main frame on file open do file open cmainframe onfileopen dofileopen void c main frame on update hide backup files c cmdui p cmdui p cmdui set check m bhidebak cmainframe onupdatehidebackupfiles ccmdui pcmdui pcmdui setcheck m_bhidebak void c main frame on help gnulicense c string spath get module path t copying c string url t http www gnu org copyleft gpl html c file status status if c file get status spath status shell execute m hwnd t open t notepad exe spath null sw shownormal else shell execute null t open url null null sw shownormal cmainframe onhelpgnulicense cstring getmodulepath _t cstring _t cfilestatus cfile getstatus shellexecute m_hwnd _t _t sw_shownormal shellexecute _t sw_shownormal void c main frame on options c string selected filter string pair array file filters the app get file filters file filters selected filter c property sheet sht ids options title c prop vss vss c prop general gen c prop syntax syn c prop filter filter file filters selected filter c prop colors colors the app get diff color the app get sel diff color c prop registry regpage sht add page gen sht add page syn sht add page filter sht add page vss sht add page colors sht add page regpage vss m nversys m nversys vss m strpath m strvsspath gen m bbackup m bbackup gen m nignorewhite m nignorewhitespace gen m bignorecase m bignorecase gen m bignoreblanklines m bignoreblanklines gen m beolsensitive m beolsensitive gen m bscroll m bscrolltofirst gen m ntabsize m ntabsize gen m ntabtype m ntabtype gen m bdisablesplash the app m bdisablesplash gen m bautomaticrescan m bautomaticrescan syn m bhilitesyntax the app m bhilitesyntax filter m bignoreregexp m bignoreregexp filter m spattern m spattern if sht do modal idok m nversys vss m nversys m strvsspath vss m strpath m bbackup gen m bbackup m bscrolltofirst gen m bscroll m ntabsize gen m ntabsize m ntabtype gen m ntabtype the app m bdisablesplash gen m bdisablesplash m bautomaticrescan gen m bautomaticrescan m nignorewhitespace gen m nignorewhite ignore all space flag m nignorewhitespace 2 ignore space change flag m nignorewhitespace 1 ignore blank lines flag m bignoreblanklines gen m bignoreblanklines m beolsensitive gen m beolsensitive ignore eol diff m beolsensitive ignore case flag m bignorecase gen m bignorecase ignore some changes m nignorewhitespace 0 m bignorecase m bignoreblanklines m beolsensitive length varies m nignorewhitespace 0 m bignoreregexp filter m bignoreregexp m spattern filter m spattern the app set file filter path filter m sfilefilterpath the app set diff color colors m clrdiff the app set sel diff color colors m clrseldiff the app write profile int t settings t version system m nversys the app write profile int t settings t ignore space m nignorewhitespace the app write profile int t settings t scroll to first m bscrolltofirst the app write profile int t settings t backup file m bbackup the app write profile string t settings t vss path m strvsspath the app write profile int t settings t tab size m ntabsize the app write profile int t settings t tab type m ntabtype the app write profile int t settings t eol sensitive m beolsensitive the app write profile int t settings t automatic rescan m bautomaticrescan the app write profile int t settings t ignore blank lines m bignoreblanklines the app write profile int t settings t ignore case m bignorecase the app write profile int t settings t ignore reg exp m bignoreregexp the app write profile string t settings t reg exps m spattern the app write profile int t settings t disable splash the app m bdisablesplash the app write profile string t settings t file filter path filter m sfilefilterpath the app m bhilitesyntax syn m bhilitesyntax the app write profile int t settings t hilite syntax the app m bhilitesyntax rebuild reg exp list make an attempt at rescanning any open diff sessions merge doc list docs get all merge docs docs bool saved all true while docs is empty c merge doc p merge doc docs remove head c merge edit view p left p merge doc get left view c merge edit view p right p merge doc get right view enable disable automatic rescan rescan after editing p left enable rescan m bautomaticrescan p right enable rescan m bautomaticrescan set tab type tabs spaces if m ntabtype 0 p left set insert tabs true p right set insert tabs true else p left set insert tabs false p right set insert tabs false if p merge doc save helper int n rescan result rescan ok n rescan result p merge doc rescan true if n rescan result rescan ok p merge doc show rescan error n rescan result mods have been made so just warn else saved all false if saved all afx message box ids diff open no set props mb iconexclamation cmainframe onoptions cstring selectedfilter stringpairarray filefilters theapp getfilefilters filefilters selectedfilter cpropertysheet ids_options_title cpropvss cpropgeneral cpropsyntax cpropfilter filefilters selectedfilter cpropcolors theapp getdiffcolor theapp getseldiffcolor cpropregistry addpage addpage addpage addpage addpage addpage m_nversys m_nversys m_strpath m_strvsspath m_bbackup m_bbackup m_nignorewhite m_nignorewhitespace m_bignorecase m_bignorecase m_bignoreblanklines m_bignoreblanklines m_beolsensitive m_beolsensitive m_bscroll m_bscrolltofirst m_ntabsize m_ntabsize m_ntabtype m_ntabtype m_bdisablesplash theapp m_bdisablesplash m_bautomaticrescan m_bautomaticrescan m_bhilitesyntax theapp m_bhilitesyntax m_bignoreregexp m_bignoreregexp m_spattern m_spattern domodal m_nversys m_nversys m_strvsspath m_strpath m_bbackup m_bbackup m_bscrolltofirst m_bscroll m_ntabsize m_ntabsize m_ntabtype m_ntabtype theapp m_bdisablesplash m_bdisablesplash m_bautomaticrescan m_bautomaticrescan m_nignorewhitespace m_nignorewhite ignore_all_space_flag m_nignorewhitespace ignore_space_change_flag m_nignorewhitespace ignore_blank_lines_flag m_bignoreblanklines m_bignoreblanklines m_beolsensitive m_beolsensitive ignore_eol_diff m_beolsensitive ignore_case_flag m_bignorecase m_bignorecase ignore_some_changes m_nignorewhitespace m_bignorecase m_bignoreblanklines m_beolsensitive length_varies m_nignorewhitespace m_bignoreregexp m_bignoreregexp m_spattern m_spattern theapp setfilefilterpath m_sfilefilterpath theapp setdiffcolor m_clrdiff theapp setseldiffcolor m_clrseldiff theapp writeprofileint _t _t versionsystem m_nversys theapp writeprofileint _t _t ignorespace m_nignorewhitespace theapp writeprofileint _t _t scrolltofirst m_bscrolltofirst theapp writeprofileint _t _t backupfile m_bbackup theapp writeprofilestring _t _t vsspath m_strvsspath theapp writeprofileint _t _t tabsize m_ntabsize theapp writeprofileint _t _t tabtype m_ntabtype theapp writeprofileint _t _t eolsensitive m_beolsensitive theapp writeprofileint _t _t automaticrescan m_bautomaticrescan theapp writeprofileint _t _t ignoreblanklines m_bignoreblanklines theapp writeprofileint _t _t ignorecase m_bignorecase theapp writeprofileint _t _t ignoreregexp m_bignoreregexp theapp writeprofilestring _t _t regexps m_spattern theapp writeprofileint _t _t disablesplash theapp m_bdisablesplash theapp writeprofilestring _t _t filefilterpath m_sfilefilterpath theapp m_bhilitesyntax m_bhilitesyntax theapp writeprofileint _t _t hilitesyntax theapp m_bhilitesyntax rebuildregexplist mergedoclist getallmergedocs savedall isempty cmergedoc pmergedoc removehead cmergeeditview pleft pmergedoc getleftview cmergeeditview pright pmergedoc getrightview pleft enablerescan m_bautomaticrescan pright enablerescan m_bautomaticrescan m_ntabtype pleft setinserttabs pright setinserttabs pleft setinserttabs pright setinserttabs pmergedoc savehelper nrescanresult rescan_ok nrescanresult pmergedoc nrescanresult rescan_ok pmergedoc showrescanerror nrescanresult savedall savedall afxmessagebox ids_diff_open_no_set_props mb_iconexclamation void c main frame on hide backup files m bhidebak m bhidebak the app write profile int t settings t hide bak m bhidebak redisplay all dir docs cmainframe onhidebackupfiles m_bhidebak m_bhidebak theapp writeprofileint _t _t hidebak m_bhidebak redisplayalldirdocs void c main frame on view selectfont choosefont cf memset cf 0 sizeof choosefont cf l struct size sizeof choosefont cf flags cf inittologfontstruct cf forcefontexist cf screenfonts cf fixedpitchonly cf lp log font m lfdiff if choose font cf m bfontspecified true the app write profile int t font t specified m bfontspecified the app write profile int t font t height m lfdiff lf height the app write profile int t font t width m lfdiff lf width the app write profile int t font t escapement m lfdiff lf escapement the app write profile int t font t orientation m lfdiff lf orientation the app write profile int t font t weight m lfdiff lf weight the app write profile int t font t italic m lfdiff lf italic the app write profile int t font t underline m lfdiff lf underline the app write profile int t font t strike out m lfdiff lf strike out the app write profile int t font t char set m lfdiff lf char set the app write profile int t font t out precision m lfdiff lf out precision the app write profile int t font t clip precision m lfdiff lf clip precision the app write profile int t font t quality m lfdiff lf quality the app write profile int t font t pitch and family m lfdiff lf pitch and family the app write profile string t font t face name m lfdiff lf face name afx message box ids font change mb iconinformation merge edit view list edit views get all views edit views null for position pos edit views get head position pos edit views get next pos c merge edit view p edit view edit views get at pos update p edit view for font change cmainframe onviewselectfont lstructsize cf_inittologfontstruct cf_forcefontexist cf_screenfonts cf_fixedpitchonly lplogfont m_lfdiff choosefont m_bfontspecified theapp writeprofileint _t _t m_bfontspecified theapp writeprofileint _t _t m_lfdiff lfheight theapp writeprofileint _t _t m_lfdiff lfwidth theapp writeprofileint _t _t m_lfdiff lfescapement theapp writeprofileint _t _t m_lfdiff lforientation theapp writeprofileint _t _t m_lfdiff lfweight theapp writeprofileint _t _t m_lfdiff lfitalic theapp writeprofileint _t _t m_lfdiff lfunderline theapp writeprofileint _t _t strikeout m_lfdiff lfstrikeout theapp writeprofileint _t _t charset m_lfdiff lfcharset theapp writeprofileint _t _t outprecision m_lfdiff lfoutprecision theapp writeprofileint _t _t clipprecision m_lfdiff lfclipprecision theapp writeprofileint _t _t m_lfdiff lfquality theapp writeprofileint _t _t pitchandfamily m_lfdiff lfpitchandfamily theapp writeprofilestring _t _t facename m_lfdiff lffacename afxmessagebox ids_font_change mb_iconinformation mergeeditviewlist editviews getallviews editviews editviews getheadposition editviews getnext cmergeeditview peditview editviews getat peditview void c main frame on view usedefaultfont m bfontspecified false the app write profile int t font t specified m bfontspecified cmainframe onviewusedefaultfont m_bfontspecified theapp writeprofileint _t _t m_bfontspecified void c main frame on update view usedefaultfont c cmdui p cmdui p cmdui enable m bfontspecified cmainframe onupdateviewusedefaultfont ccmdui pcmdui pcmdui m_bfontspecified void c main frame on help contents c string spath get module path 0 t docs index html c string url t http winmerge sourceforge net docs20 index html c file status status if c file get status spath status shell execute null t open spath null null sw shownormal else shell execute null t open url null null sw shownormal cmainframe onhelpcontents cstring getmodulepath _t cstring _t cfilestatus cfile getstatus shellexecute _t sw_shownormal shellexecute _t sw_shownormal void c main frame on update help contents c cmdui p cmdui p cmdui enable true cmainframe onupdatehelpcontents ccmdui pcmdui pcmdui void c main frame on close save any dirty edit views merge doc list mergedocs get all merge docs mergedocs for position pos mergedocs get head position pos mergedocs get next pos c merge doc p merge doc mergedocs get at pos c merge edit view p left p merge doc get left view c merge edit view p right p merge doc get right view if p left p left is modified p right p right is modified if p merge doc save helper return else set modified status to false so that we are not asking about saving again p merge doc m ltbuf set modified false p merge doc m rtbuf set modified false save main window position windowplacement wp wp length sizeof windowplacement get window placement wp the app write profile int t settings t main left wp rc normal position left the app write profile int t settings t main top wp rc normal position top the app write profile int t settings t main right wp rc normal position right the app write profile int t settings t main bottom wp rc normal position bottom the app write profile int t settings t main max wp show cmd sw maximize tell all merge docs to save position while mergedocs is empty c merge doc p merge doc mergedocs remove head c merge edit view p left p merge doc get left view if p left p merge doc get parent frame save position stop handling status messages from wait status cursors wait status cursor set status display 0 my status display set frame 0 cmdi frame wnd on close cmainframe onclose mergedoclist getallmergedocs getheadposition getnext cmergedoc pmergedoc getat cmergeeditview pleft pmergedoc getleftview cmergeeditview pright pmergedoc getrightview pleft pleft ismodified pright pright ismodified pmergedoc savehelper pmergedoc m_ltbuf setmodified pmergedoc m_rtbuf setmodified getwindowplacement theapp writeprofileint _t _t mainleft rcnormalposition theapp writeprofileint _t _t maintop rcnormalposition theapp writeprofileint _t _t mainright rcnormalposition theapp writeprofileint _t _t mainbottom rcnormalposition theapp writeprofileint _t _t mainmax showcmd sw_maximize isempty cmergedoc pmergedoc removehead cmergeeditview pleft pmergedoc getleftview pleft pmergedoc getparentframe saveposition waitstatuscursors waitstatuscursor setstatusdisplay mystatusdisplay setframe cmdiframewnd onclose void c main frame on view whitespace m bviewwhitespace m bviewwhitespace the app write profile int t settings t view whitespace m bviewwhitespace merge doc list mergedocs get all merge docs mergedocs while mergedocs is empty c merge doc p merge doc mergedocs remove head c merge edit view p left p merge doc get left view c merge edit view p right p merge doc get right view if p left p left set view tabs mf m bviewwhitespace if p right p right set view tabs mf m bviewwhitespace cmainframe onviewwhitespace m_bviewwhitespace m_bviewwhitespace theapp writeprofileint _t _t viewwhitespace m_bviewwhitespace mergedoclist getallmergedocs isempty cmergedoc pmergedoc removehead cmergeeditview pleft pmergedoc getleftview cmergeeditview pright pmergedoc getrightview pleft pleft setviewtabs m_bviewwhitespace pright pright setviewtabs m_bviewwhitespace void c main frame on update view whitespace c cmdui p cmdui p cmdui set check m bviewwhitespace cmainframe onupdateviewwhitespace ccmdui pcmdui pcmdui setcheck m_bviewwhitespace void c main frame on drop files hdrop drop info get the number of pathnames that have been dropped uint w num files dropped drag query file drop info 0xffffffff null 0 c string files 2 uint file count 0 get all file names but we ll only need the first one for word x 0 x w num files dropped x get the number of bytes required by the file s full pathname uint w pathname size drag query file drop info x null 0 allocate memory to contain full pathname zero byte w pathname size 1 lptstr npsz file tchar new tchar w pathname size if not enough memory skip this one if npsz file null continue copy the pathname into the buffer drag query file drop info x npsz file w pathname size if x 2 files x npsz file file count delete npsz file free the memory block containing the dropped file information drag finish drop info for uint i 0 i file count i if this was a shortcut we need to expand it to the target path c string expanded file expand shortcut files i if that worked we should have a real file name if expanded file is empty files i expanded file if ctrl pressed do recursive compare bool ctrl key get async key state vk control do file open files 0 files 1 ffileopen none ffileopen none ctrl key cmainframe ondropfiles dropinfo wnumfilesdropped dragqueryfile dropinfo cstring filecount wnumfilesdropped wpathnamesize dragqueryfile dropinfo wpathnamesize npszfile wpathnamesize npszfile dragqueryfile dropinfo npszfile wpathnamesize npszfile filecount npszfile dragfinish dropinfo filecount cstring expandedfile expandshortcut expandedfile isempty expandedfile ctrlkey getasynckeystate vk_control dofileopen ffileopen_none ffileopen_none ctrlkey void c main frame add to mru lpcstr sz item lpcstr sz reg sub key uint n max items c string s s2 uint cnt afx get app get profile int sz reg sub key count 0 cnt add new string if cnt n max items cnt n max items move items down a step for uint i cnt i 0 i s2 format item d i 1 s afx get app get profile string sz reg sub key s2 s2 format item d i afx get app write profile string sz reg sub key s2 s add most recent item afx get app write profile string sz reg sub key item 0 sz item update count afx get app write profile int sz reg sub key count cnt cmainframe addtomru szitem szregsubkey nmaxitems cstring afxgetapp getprofileint szregsubkey nmaxitems nmaxitems item_ afxgetapp getprofilestring szregsubkey item_ afxgetapp writeprofilestring szregsubkey afxgetapp writeprofilestring szregsubkey item_0 szitem afxgetapp writeprofileint szregsubkey void c main frame rebuild reg exp list tchar tmp max path 0 tchar token tchar sep r n destroy the old list if the it is not null free reg exp list build the new list if the user choose to ignore lines matching the reg expression patterns if m bignoreregexp find each regular expression and add to list tcscpy tmp m spattern token tcstok tmp sep while token add regexp ignore regexp list token token tcstok null sep if ignore regexp list ignore some changes 1 cmainframe rebuildregexplist _tchar _max_path _tchar _tchar freeregexplist m_bignoreregexp _tcscpy m_spattern _tcstok add_regexp ignore_regexp_list _tcstok ignore_regexp_list ignore_some_changes void c main frame free reg exp list struct regexp list r r ignore regexp list iterate through the list free the reg expression list item while ignore regexp list r r next free ignore regexp list buf fastmap free ignore regexp list buf buffer free ignore regexp list ignore regexp list r cmainframe freeregexplist regexp_list ignore_regexp_list ignore_regexp_list ignore_regexp_list ignore_regexp_list ignore_regexp_list ignore_regexp_list void c main frame get all views merge edit view list p edit views dir view list p dir views for position pos afx get app get first doc template position pos c doc template p template afx get app get next doc template pos for position pos2 p template get first doc position pos2 c document p doc p template get next doc pos2 c merge doc p merge doc dynamic cast c merge doc p doc c dir doc p dir doc dynamic cast c dir doc p doc for position pos3 p doc get first view position pos3 c view p view p doc get next view pos3 if p merge doc if p edit views a merge doc only has merge edit views c merge edit view p edit view dynamic cast c merge edit view p view assert p edit view p edit views add tail p edit view else if p dir doc if p dir views a dir doc only has dir views c dir view p dir view dynamic cast c dir view p view assert p dir view p dir views add tail p dir view else there are currently only two types of docs 2003 02 20 assert 0 cmainframe getallviews mergeeditviewlist peditviews dirviewlist pdirviews afxgetapp getfirstdoctemplateposition cdoctemplate ptemplate afxgetapp getnextdoctemplate ptemplate getfirstdocposition cdocument pdoc ptemplate getnextdoc cmergedoc pmergedoc dynamic_cast cmergedoc pdoc cdirdoc pdirdoc dynamic_cast cdirdoc pdoc pdoc getfirstviewposition cview pview pdoc getnextview pmergedoc peditviews cmergeeditview peditview dynamic_cast cmergeeditview pview peditview peditviews addtail peditview pdirdoc pdirviews cdirview pdirview dynamic_cast cdirview pview pdirview pdirviews addtail pdirview void c main frame get all merge docs merge doc list p merge docs c multi doc template p template the app m pdifftemplate for position pos p template get first doc position pos c document p doc p template get next doc pos c merge doc p merge doc static cast c merge doc p doc p merge docs add tail p merge doc cmainframe getallmergedocs mergedoclist pmergedocs cmultidoctemplate ptemplate theapp m_pdifftemplate ptemplate getfirstdocposition cdocument pdoc ptemplate getnextdoc cmergedoc pmergedoc static_cast cmergedoc pdoc pmergedocs addtail pmergedoc void c main frame get all dir docs dir doc list p dir docs c multi doc template p template the app m pdirtemplate for position pos p template get first doc position pos c document p doc p template get next doc pos c dir doc p dir doc static cast c dir doc p doc p dir docs add tail p dir doc cmainframe getalldirdocs dirdoclist pdirdocs cmultidoctemplate ptemplate theapp m_pdirtemplate ptemplate getfirstdocposition cdocument pdoc ptemplate getnextdoc cdirdoc pdirdoc static_cast cdirdoc pdoc pdirdocs addtail pdirdoc void c main frame redisplay all dir docs dir doc list dirdocs get all dir docs dirdocs while dirdocs is empty c dir doc p dir doc dirdocs remove head p dir doc redisplay cmainframe redisplayalldirdocs dirdoclist getalldirdocs isempty cdirdoc pdirdoc removehead pdirdoc c merge doc c main frame get merge doc to show c dir doc p dir doc bool p new c merge doc p merge doc p dir doc get merge doc for diff p new return p merge doc cmergedoc cmainframe getmergedoctoshow cdirdoc pdirdoc pnew cmergedoc pmergedoc pdirdoc getmergedocfordiff pnew pmergedoc c dir doc c main frame get dir doc to show bool p new c dir doc p dir doc 0 if m breusedirdoc position pos the app m pdirtemplate get first doc position if pos p dir doc static cast c dir doc the app m pdirtemplate get next doc pos p new false if p dir doc p dir doc c dir doc the app m pdirtemplate open document file null p new true return p dir doc cdirdoc cmainframe getdirdoctoshow pnew cdirdoc pdirdoc m_breusedirdoc theapp m_pdirtemplate getfirstdocposition pdirdoc static_cast cdirdoc theapp m_pdirtemplate getnextdoc pnew pdirdoc pdirdoc cdirdoc theapp m_pdirtemplate opendocumentfile pnew pdirdoc m besccloses false todo add construction code here place all significant initialization in init instance m_besccloses initinstance void c merge app set diff color colorref clr value m clrdiff clr value cmergeapp setdiffcolor clrvalue m_clrdiff clrvalue void c merge app set sel diff color colorref clr value m clrseldiff clr value cmergeapp setseldiffcolor clrvalue m_clrseldiff clrvalue void c merge app set need idle timer m bneedidletimer true cmergeapp setneedidletimer m_bneedidletimer void c merge app set file filter path lpctstr sz file filter path m sfilefilterpath t none if m filefiltermgr return m currentfilter m filefiltermgr get filter by path sz file filter path if m currentfilter m sfilefilterpath sz file filter path cmergeapp setfilefilterpath szfilefilterpath m_sfilefilterpath _t m_filefiltermgr m_currentfilter m_filefiltermgr getfilterbypath szfilefilterpath m_currentfilter m_sfilefilterpath szfilefilterpath void c merge app get file filters string pair array filters c string selected const if m filefiltermgr int count m filefiltermgr get filter count filters set size count for int i 0 i count i string pair pair pair first m filefiltermgr get filter path i pair second m filefiltermgr get filter name i filters set at i pair selected m sfilefilterpath cmergeapp getfilefilters stringpairarray cstring m_filefiltermgr m_filefiltermgr getfiltercount setsize stringpair m_filefiltermgr getfilterpath m_filefiltermgr getfiltername setat m_sfilefilterpath bool c merge app include file lpctstr sz file name if m filefiltermgr m currentfilter return true return m filefiltermgr test file name against filter m currentfilter sz file name cmergeapp includefile szfilename m_filefiltermgr m_currentfilter m_filefiltermgr testfilenameagainstfilter m_currentfilter szfilename bool c merge app include dir lpctstr sz dir name if m filefiltermgr m currentfilter return true return m filefiltermgr test dir name against filter m currentfilter sz dir name cmergeapp includedir szdirname m_filefiltermgr m_currentfilter m_filefiltermgr testdirnameagainstfilter m_currentfilter szdirname bool c merge app init instance ifdef debug silly test crap endif runtime switch so programmer may set this in interactive debugger int dbgmem 0 if dbgmem get current setting int tmp flag crtsetdbgflag crtdbg report flag keep freed memory blocks in the heap s linked list and mark them as freed tmp flag crtdbg delay free mem df call crtcheckmemory at every allocation and deallocation request tmp flag crtdbg check always df set the new state for the flag crtsetdbgflag tmp flag c crystal edit drag and drop functionality needs afx ole init if afx ole init trace t afx ole init failed ole functionality disabled standard initialization if you are not using these features and wish to reduce the size of your final executable you should remove from the following the specific initialization routines you do not need ifdef afxdll enable3d controls call this when using mfc in a shared dll else enable3d controls static call this when linking to mfc statically endif change the registry key under which our settings are stored you should modify this string to be something appropriate such as the name of your company or organization set registry key t thingamahoochie load std profile settings 0 load standard ini file options including mru m bdisablesplash get profile int t settings t disable splash false m bhilitesyntax get profile int t settings t hilite syntax true 0 m clrdiff get profile int t settings t difference color m clrdiff m clrseldiff get profile int t settings t selected difference color m clrseldiff cg the following block was added by the splash screen component c command line info cmd info parse command line cmd info c splash wnd enable splash screen m bdisablesplash false cmd info m nshellcommand c command line info file new initialize i18n multiple language support m lang set log file g log m lang initialize language add english resource hook use english string when l10n foreign string missing initialize file filters register the application s document templates document templates serve as the connection between documents frame windows and views m pdifftemplate new c multi doc template idr mergetype runtime class c merge doc runtime class c child frame custom mdi child frame runtime class c merge edit view add doc template m pdifftemplate m pdirtemplate new c multi doc template idr mergetype runtime class c dir doc runtime class c dir frame custom mdi child frame runtime class c dir view add doc template m pdirtemplate create main mdi frame window c main frame p main frame new c main frame if p main frame load frame idr mainframe return false m pmainwnd p main frame enable drag drop files p main frame modify style ex null ws ex acceptfiles p main frame m hmenudefault p main frame new default menu this simulates a window being opened if you don t have a default window displayed at startup p main frame on update frame menu p main frame m hmenudefault parse command line for standard shell commands dde file open c command line info cmd info parse command line cmd info dispatch commands specified on the command line if cmd info m nshellcommand c command line info file new cmd info m nshellcommand c command line info file nothing if process shell command cmd info return false the main window has been initialized so show and update it p main frame show window m ncmdshow p main frame activate frame m ncmdshow p main frame update window c string array files uint n files 0 bool recurse false files set size 2 dword dw left flags 0 dword dw right flags 0 split commandline arguments into files flags recursive flag parse args files n files recurse dw left flags dw right flags if n files 2 p main frame m strsaveaspath files 2 p main frame do file open files 0 files 1 dw left flags dw right flags recurse else if n files 1 p main frame m strsaveaspath t p main frame do file open files 0 files 1 dw left flags dw right flags recurse else if n files 0 p main frame m strsaveaspath t p main frame do file open files 0 dw left flags dw right flags recurse return true cmergeapp initinstance _debug sillytestcrap tmpflag _crtsetdbgflag _crtdbg_report_flag tmpflag _crtdbg_delay_free_mem_df _crtcheckmemory tmpflag _crtdbg_check_always_df _crtsetdbgflag tmpflag ccrystaledit afxoleinit afxoleinit _t afxoleinitfailed _afxdll enable3dcontrols enable3dcontrolsstatic setregistrykey _t loadstdprofilesettings m_bdisablesplash getprofileint _t _t disablesplash m_bhilitesyntax getprofileint _t _t hilitesyntax m_clrdiff getprofileint _t _t differencecolor m_clrdiff m_clrseldiff getprofileint _t _t selecteddifferencecolor m_clrseldiff ccommandlineinfo cmdinfo parsecommandline cmdinfo csplashwnd enablesplashscreen m_bdisablesplash cmdinfo m_nshellcommand ccommandlineinfo filenew m_lang setlogfile glog m_lang initializelanguage addenglishresourcehook initializefilefilters m_pdifftemplate cmultidoctemplate idr_mergetype runtime_class cmergedoc runtime_class cchildframe runtime_class cmergeeditview adddoctemplate m_pdifftemplate m_pdirtemplate cmultidoctemplate idr_mergetype runtime_class cdirdoc runtime_class cdirframe runtime_class cdirview adddoctemplate m_pdirtemplate cmainframe pmainframe cmainframe pmainframe loadframe idr_mainframe m_pmainwnd pmainframe pmainframe modifystyleex ws_ex_acceptfiles pmainframe m_hmenudefault pmainframe newdefaultmenu pmainframe onupdateframemenu pmainframe m_hmenudefault ccommandlineinfo cmdinfo parsecommandline cmdinfo cmdinfo m_nshellcommand ccommandlineinfo filenew cmdinfo m_nshellcommand ccommandlineinfo filenothing processshellcommand cmdinfo pmainframe showwindow m_ncmdshow pmainframe activateframe m_ncmdshow pmainframe updatewindow cstringarray nfiles setsize dwleftflags dwrightflags parseargs nfiles dwleftflags dwrightflags nfiles pmainframe m_strsaveaspath pmainframe dofileopen dwleftflags dwrightflags nfiles pmainframe m_strsaveaspath _t pmainframe dofileopen dwleftflags dwrightflags nfiles pmainframe m_strsaveaspath _t pmainframe dofileopen dwleftflags dwrightflags int c merge app exit instance write profile int t settings t difference color m clrdiff write profile int t settings t selected difference color m clrseldiff delete m filefiltermgr return c win app exit instance cmergeapp exitinstance writeprofileint _t _t differencecolor m_clrdiff writeprofileint _t _t selecteddifferencecolor m_clrseldiff m_filefiltermgr cwinapp exitinstance int c merge app do message box lpctstr lpsz prompt uint n type uint nid prompt this is just a convenient point for breakpointing return c win app do message box lpsz prompt n type nid prompt cmergeapp domessagebox lpszprompt ntype nidprompt cwinapp domessagebox lpszprompt ntype nidprompt bool c merge app on idle long l count if c win app on idle l count return true if anyone has requested notification when next idle occurs send it if m bneedidletimer m bneedidletimer false m pmainwnd send message to descendants wm timer idle timer l count true false return false cmergeapp onidle lcount cwinapp onidle lcount m_bneedidletimer m_bneedidletimer m_pmainwnd sendmessagetodescendants wm_timer idle_timer lcount bool c merge app pre translate message msg p msg check if we got esc pressed message if p msg message wm keydown p msg w param vk escape if e commandline parameter were given close win merge note without e commandline parameter we only close active window dialog see c dir view pre translate message and c merge edit view pre translate message if m besccloses afx get main wnd post message wm close return false cg the following lines were added by the splash screen component if c splash wnd pre translate app message p msg return true return c win app pre translate message p msg cmergeapp pretranslatemessage pmsg pmsg wm_keydown pmsg wparam vk_escape winmerge cdirview pretranslatemessage cmergeeditview pretranslatemessage m_besccloses afxgetmainwnd postmessage wm_close csplashwnd pretranslateappmessage pmsg cwinapp pretranslatemessage pmsg void c merge app initialize file filters if m filefiltermgr m filefiltermgr new file filter mgr load filters from all possible subdirectories c map c string lpctstr int int patterns loaded application directory c string s pattern get module path t filters flt load file filter dir pattern patterns loaded s pattern application data path in user profile directory if get app data path s pattern s pattern t win merge filters flt load file filter dir pattern patterns loaded s pattern user profile local roaming settings c string s profile if get user profile path s profile s pattern s profile t local settings application data win merge filters flt load file filter dir pattern patterns loaded s pattern s pattern s profile t application data win merge filters flt load file filter dir pattern patterns loaded s pattern cmergeapp initializefilefilters m_filefiltermgr m_filefiltermgr filefiltermgr cmap cstring patternsloaded cstring spattern getmodulepath _t loadfilefilterdirpattern patternsloaded spattern getappdatapath spattern spattern _t winmerge loadfilefilterdirpattern patternsloaded spattern cstring sprofile getuserprofilepath sprofile spattern sprofile _t winmerge loadfilefilterdirpattern patternsloaded spattern spattern sprofile _t winmerge loadfilefilterdirpattern patternsloaded spattern c merge app load file filter dir pattern c map c string lpctstr int int patterns loaded const c string s pattern int n 0 if patterns loaded lookup s pattern n m filefiltermgr load from directory s pattern t flt patterns loaded s pattern n cmergeapp loadfilefilterdirpattern cmap cstring patternsloaded cstring spattern patternsloaded spattern m_filefiltermgr loadfromdirectory spattern _t patternsloaded spattern void c merge app parse args c string array files uint n files bool recurse dword dw left flags dword dw right flags for int i 1 i argc i lpctstr psz param targv i if psz param 0 psz param 0 remove flag specifier psz param r to compare recursively if tcsicmp psz param t r recurse true e to allow closing with single esc press if tcsicmp psz param t e m besccloses true ur to not add left path to meu if tcsicmp psz param t ul dw left flags ffileopen nomru ur to not add right path to mru if tcsicmp psz param t ur dw right flags ffileopen nomru ub to not add paths to mru if tcsicmp psz param t ub dw left flags ffileopen nomru dw right flags ffileopen nomru else c string s param psz param c string s file paths getlongpath s param dirslash files set at grow n files s file n files if compare file dir make it compare file dir file if n files 2 path existence p1 paths doespathexist files 0 path existence p2 paths doespathexist files 1 if p1 is existing file p2 is existing dir tchar fname max path fext max path tsplitpath files 0 null null fname fext if files 1 right 1 t files 1 t files 1 files 1 fname fext cmergeapp parseargs cstringarray nfiles dwleftflags dwrightflags __argc pszparam __targv pszparam pszparam pszparam _tcsicmp pszparam _t _tcsicmp pszparam _t m_besccloses _tcsicmp pszparam _t dwleftflags ffileopen_nomru _tcsicmp pszparam _t dwrightflags ffileopen_nomru _tcsicmp pszparam _t dwleftflags ffileopen_nomru dwrightflags ffileopen_nomru cstring sparam pszparam cstring sfile paths_getlongpath sparam setatgrow nfiles sfile nfiles nfiles path_existence paths_doespathexist path_existence paths_doespathexist is_existing_file is_existing_dir _max_path _max_path _tsplitpath _t _t void c merge app on app about c about dlg about dlg about dlg do modal cmergeapp onappabout caboutdlg aboutdlg aboutdlg domodal void c merge app on view language if m lang do modal idok m lang reload menu m langdlg update doc title mf update resources cmergeapp onviewlanguage m_lang domodal m_lang reloadmenu m_langdlg updatedoctitle updateresources c dir doc c dir doc m pdirview null m pctxt null m breusemergedocs true cdirdoc cdirdoc m_pdirview m_pctxt m_breusemergedocs c dir view c dir doc get main view why are we doing this dirdocs only have one view position pos get first view position ps2 pos while pos null c dir view p view c dir view get next view pos if p view is kind of runtime class c dir view return p view else assert 0 return c dir view get next view ps2 cdirview cdirdoc getmainview getfirstviewposition cdirview pview cdirview getnextview pview iskindof runtime_class cdirview pview cdirview getnextview c merge doc c dir doc get merge doc for diff bool p new c merge doc p merge doc 0 policy use an existing merge doc if available if m breusemergedocs m mergedocs is empty p new false p merge doc m mergedocs get head else create a new merge doc p merge doc c merge doc the app m pdifftemplate open document file null add merge doc p merge doc p merge doc set dir doc this p new true return p merge doc cmergedoc cdirdoc getmergedocfordiff pnew cmergedoc pmergedoc m_breusemergedocs m_mergedocs isempty pnew pmergedoc m_mergedocs gethead pmergedoc cmergedoc theapp m_pdifftemplate opendocumentfile addmergedoc pmergedoc pmergedoc setdirdoc pnew pmergedoc bool c dir doc reusing dir doc inform all of our merge docs that we re closing for position pos m mergedocs get head position pos c merge doc p merge doc m mergedocs get next pos if p merge doc close now return false clear diff display assert m pdirview m pdirview delete all display items delete comparison parameters and results if m pctxt null delete m pctxt m pctxt null return true cdirdoc reusingdirdoc m_mergedocs getheadposition cmergedoc pmergedoc m_mergedocs getnext pmergedoc closenow m_pdirview m_pdirview deletealldisplayitems m_pctxt m_pctxt m_pctxt bool c dir doc can frame close return m mergedocs is empty cdirdoc canframeclose m_mergedocs isempty void c dir doc serialize c archive ar if ar is storing todo add storing code here else todo add loading code here cdirdoc carchive isstoring bool c dir doc on new document if c document on new document return false c string s verify s load string ids directory window title set title s void param reinterpret cast void this get main view get parent frame set closable callback doc closable callback param return true cdirdoc onnewdocument cdocument onnewdocument cstring loadstring ids_directory_window_title settitle reinterpret_cast getmainview getparentframe setclosablecallback docclosablecallback bool c dir doc update item times lpctstr path left lpctstr path right position pos m pctxt get first diff position position current pos diffitem current int count m pctxt get diff count int i 0 bool found false c string path1 file1 split filename path left path1 file1 0 c string path2 file2 split filename path right path2 file2 0 filenames must be identical if file1 file2 return false path can contain because of difftools and so for comparing purposes convert whole path to use path1 replace path2 replace get first item current m pctxt get diff at pos while i count found false save our current pos before getting next current pos pos current m pctxt get next diff position pos path can contain because of difftools and so for comparing purposes convert whole path to use current srpath replace current slpath replace if path1 current slpath path2 current srpath file1 current sfilename right item found get index at view update filetimes to context and tell view to update found item int ind m pdirview get item index dword current pos update times current m pctxt update times current pos current ltime current rtime update item status ind current found true i return found cdirdoc updateitemtimes pathleft pathright m_pctxt getfirstdiffposition currentpos m_pctxt getdiffcount cstring splitfilename pathleft cstring splitfilename pathright m_pctxt getdiffat currentpos m_pctxt getnextdiffposition m_pdirview getitemindex currentpos updatetimes m_pctxt updatetimes currentpos updateitemstatus uint status position pos m pctxt get first diff position position current pos diffitem current int count m pctxt get diff count int i 0 bool found false c string path1 file1 split filename path left path1 file1 0 c string path2 file2 split filename path right path2 file2 0 path can contain because of difftools and so for comparing purposes convert whole path to use path1 replace path2 replace filenames must be identical if file1 file2 return false get first item current m pctxt get diff at pos while i count found false save our current pos before getting next current pos pos current m pctxt get next diff position pos path can contain because of difftools and so for comparing purposes convert whole path to use current srpath replace current slpath replace if path1 current slpath path2 current srpath file1 current sfilename right item found get index at view update status to context and tell view to update found item int ind m pdirview get item index dword current pos current code byte status m pctxt update status code current pos byte status update item status ind current found true i return found m_pctxt getfirstdiffposition currentpos m_pctxt getdiffcount cstring splitfilename pathleft cstring splitfilename pathright m_pctxt getdiffat currentpos m_pctxt getnextdiffposition m_pdirview getitemindex currentpos m_pctxt updatestatuscode currentpos updateitemstatus void c dir doc set diff context c diff context p ctxt if m pctxt null delete m pctxt m pctxt p ctxt cdirdoc setdiffcontext cdiffcontext pctxt m_pctxt m_pctxt m_pctxt pctxt void c dir doc update resources m pdirview update resources c string s verify s load string ids directory window title set title s redisplay cdirdoc updateresources m_pdirview updateresources cstring loadstring ids_directory_window_title settitle void c dir doc init status strings cdirdoc initstatusstrings void c dir doc update item status uint n idx position diffpos m pdirview get item key n idx diffitem di m pctxt get diff at diffpos update times di in case just copied into existence or modified update item status n idx di cdirdoc updateitemstatus nidx m_pdirview getitemkey nidx m_pctxt getdiffat updatetimes updateitemstatus nidx void c dir doc set item status uint n idx lpctstr sz status int image const int64 ltime const int64 rtime m pdirview add item n idx dv status sz status m pdirview set image n idx image m pdirview add item n idx dv ltime time string ltime m pdirview add item n idx dv rtime time string rtime cdirdoc setitemstatus nidx szstatus __int64 __int64 m_pdirview additem nidx dv_status szstatus m_pdirview setimage nidx m_pdirview additem nidx dv_ltime timestring m_pdirview additem nidx dv_rtime timestring void c dir doc redisplay if m pctxt null return c string s s2 uint cnt 0 int llen m pctxt m strnormalizedleft get length int rlen m pctxt m strnormalizedright get length m pdirview delete all display items position diffpos m pctxt get first diff position while diffpos position curdiffpos diffpos diffitem di m pctxt get next diff position diffpos lpctstr p get item path if showable di llen rlen if p m pdirview add item cnt dv name di sfilename m pdirview add item cnt dv ext di sext bsp add the current file extension s t s p m pdirview add item cnt dv path s m pdirview set item key cnt curdiffpos update item status cnt di cnt m pdirview sort columns appropriately cdirdoc m_pctxt cstring m_pctxt m_strnormalizedleft getlength m_pctxt m_strnormalizedright getlength m_pdirview deletealldisplayitems m_pctxt getfirstdiffposition m_pctxt getnextdiffposition getitempathifshowable m_pdirview additem dv_name m_pdirview additem dv_ext _t m_pdirview additem dv_path m_pdirview setitemkey updateitemstatus m_pdirview sortcolumnsappropriately void c dir doc rescan if m pctxt return wait status cursor waitstatus load res string ids status rescanning dir doc status mfst c main frame the app m pmainwnd dir doc filter mfflt g log write t starting directory scan r n t left s r n t right s r n m pctxt m strleft m pctxt m strright m pctxt remove all fix up for diff code remove trailing slashes etc m pctxt m strnormalizedleft m pctxt m strleft m pctxt m strnormalizedright m pctxt m strright paths normalize m pctxt m strnormalizedleft paths normalize m pctxt m strnormalizedright m pctxt m pistatus mfst m pctxt m pifilter mfflt compare files 0 char const lpctstr m pctxt m strnormalizedleft 0 char const lpctstr m pctxt m strnormalizedright m pctxt 0 m pctxt m pistatus 0 m pctxt m pifilter 0 g log write t directory scan complete r n c string s afx format string2 s ids directory window status fmt m pctxt m strleft m pctxt m strright c dir frame m pdirview get parent set status s redisplay cdirdoc m_pctxt waitstatuscursor loadresstring ids_status_rescanning dirdocstatus cmainframe theapp m_pmainwnd dirdocfilter glog _t tleft tright m_pctxt m_strleft m_pctxt m_strright m_pctxt removeall m_pctxt m_strnormalizedleft m_pctxt m_strleft m_pctxt m_strnormalizedright m_pctxt m_strright paths_normalize m_pctxt m_strnormalizedleft paths_normalize m_pctxt m_strnormalizedright m_pctxt m_pistatus m_pctxt m_pifilter compare_files m_pctxt m_strnormalizedleft m_pctxt m_strnormalizedright m_pctxt m_pctxt m_pistatus m_pctxt m_pifilter glog _t cstring afxformatstring2 ids_directory_window_status_fmt m_pctxt m_strleft m_pctxt m_strright cdirframe m_pdirview getparent setstatus c dir doc c dir doc if m pctxt null delete m pctxt inform all of our merge docs that we re closing for position pos m mergedocs get head position pos c merge doc p merge doc m mergedocs get next pos p merge doc dir doc closing this cdirdoc cdirdoc m_pctxt m_pctxt m_mergedocs getheadposition cmergedoc pmergedoc m_mergedocs getnext pmergedoc dirdocclosing void c dir doc set dir view c dir view new view c dir view current view m pdirview m pdirview new view mfc has a view list for us so lets check against it position pos get first view position c dir view temp static cast c dir view get next view pos assert temp m pdirview verify that our stashed pointer is the same as mfc s cdirdoc setdirview cdirview newview cdirview currentview m_pdirview m_pdirview newview getfirstviewposition cdirview static_cast cdirview getnextview m_pdirview void c dir doc add merge doc c merge doc p merge doc assert p merge doc m mergedocs add tail p merge doc cdirdoc addmergedoc cmergedoc pmergedoc pmergedoc m_mergedocs addtail pmergedoc void c dir doc merge doc closing c merge doc p merge doc assert p merge doc position pos m mergedocs find p merge doc assert pos m mergedocs remove at pos cdirdoc mergedocclosing cmergedoc pmergedoc pmergedoc m_mergedocs pmergedoc m_mergedocs removeat void c dir doc update item status uint n idx diffitem di c string s switch di code case file diff verify s load string ids files are different set item status n idx s file diff di ltime di rtime break case file bindiff verify s load string ids bin files diff set item status n idx s file bindiff di ltime di rtime break case file binsame verify s load string ids bin files same set item status n idx s file binsame di ltime di rtime break case file lunique case file ldirunique afx format string1 s ids only in fmt di slpath set item status n idx s di code di ltime null break case file runique case file rdirunique afx format string1 s ids only in fmt di srpath set item status n idx s di code null di rtime break case file same verify s load string ids identical set item status n idx s file same di ltime di rtime break default error verify s load string ids cant compare files set item status n idx s file error di ltime 0 di ltime null di rtime 0 di rtime null break cdirdoc updateitemstatus nidx cstring file_diff loadstring ids_files_are_different setitemstatus nidx file_diff file_bindiff loadstring ids_bin_files_diff setitemstatus nidx file_bindiff file_binsame loadstring ids_bin_files_same setitemstatus nidx file_binsame file_lunique file_ldirunique afxformatstring1 ids_only_in_fmt setitemstatus nidx file_runique file_rdirunique afxformatstring1 ids_only_in_fmt setitemstatus nidx file_same loadstring ids_identical setitemstatus nidx file_same loadstring ids_cant_compare_files setitemstatus nidx file_error file filter mgr file filter mgr delete all filters filefiltermgr filefiltermgr deleteallfilters void file filter mgr load from directory lpctstr sz pattern lpctstr sz ext delete all filters c file find finder bool b working finder find file sz pattern int extlen sz ext tcslen sz ext 0 while b working b working finder find next file if finder is dots finder is directory continue c string s filename finder get file name if sz ext caller specified a specific extension this is really a workaround for brokenness in windows which doesn t screen correctly on extension in pattern if s filename right extlen compare no case sz ext return load filter file finder get file path s filename filefiltermgr loadfromdirectory szpattern szext deleteallfilters cfilefind bworking findfile szpattern szext _tcslen szext bworking bworking findnextfile isdots isdirectory cstring sfilename getfilename szext sfilename comparenocase szext loadfilterfile getfilepath sfilename file filter file filter mgr get filter by path lpctstr sz filter path for int i 0 i m filters get size i if m filters i fullpath sz filter path return m filters i return 0 filefilter filefiltermgr getfilterbypath szfilterpath m_filters getsize m_filters szfilterpath m_filters void file filter mgr delete all filters for int i 0 i m filters get size i delete m filters i m filters i 0 m filters remove all filefiltermgr deleteallfilters m_filters getsize m_filters m_filters m_filters removeall void file filter mgr load filter file lpctstr sz filepath lpctstr sz filename c stdio file file if file open sz filepath c file mode read return file filter pfilter new file filter pfilter fullpath sz filepath pfilter name sz filename default if no name c string s line while file read string s line if 0 tcsncmp s line t name 5 specifies display name c string str s line mid 5 str trim left if str is empty pfilter name str else if 0 tcsncmp s line t def 4 specifies default c string str s line mid 4 str trim left if str t 0 str t no str t exclude pfilter default include false else if str t 1 str t yes str t include pfilter default include true else if 0 tcsncmp s line t f 2 file filter c string str s line mid 2 add filter pattern pfilter filefilters str else if 0 tcsncmp s line t d 2 directory filter c string str s line mid 2 add filter pattern pfilter dirfilters str m filters add pfilter filefiltermgr loadfilterfile szfilepath szfilename cstdiofile szfilepath cfile moderead filefilter filefilter szfilepath szfilename cstring sline readstring sline _tcsncmp sline _t cstring sline trimleft isempty _tcsncmp sline _t cstring sline trimleft _t _t _t default_include _t _t _t default_include _tcsncmp sline _t cstring sline addfilterpattern _tcsncmp sline _t cstring sline addfilterpattern m_filters c diff context c diff context lpctstr psz left null lpctstr psz right null m brecurse false m strleft psz left m strright psz right m plist m dirlist p names left null p names right null m pistatus 0 m pifilter 0 cdiffcontext cdiffcontext pszleft pszright m_brecurse m_strleft pszleft m_strright pszright m_plist m_dirlist pnamesleft pnamesright m_pistatus m_pifilter c diff context c diff context lpctstr psz left lpctstr psz right c diff context src this is used somehow in recursive comparisons i think that it is only used during rescan to copy into temporaries which modify the original because pointers are copied below and then the temporary goes away so the temporary never exists while the user is interacting with the gui m brecurse src m brecurse m strleft psz left m strright psz right m plist src m plist set reg exp src m strregexp m pistatus src m pistatus m pifilter src m pifilter p names left null p names right null cdiffcontext cdiffcontext pszleft pszright cdiffcontext m_brecurse m_brecurse m_strleft pszleft m_strright pszright m_plist m_plist setregexp m_strregexp m_pistatus m_pistatus m_pifilter m_pifilter pnamesleft pnamesright c diff context c diff context if p names left null free p names left if p names right null free p names right cdiffcontext cdiffcontext pnamesleft pnamesleft pnamesright pnamesright void c diff context set reg exp lpctstr psz exp m strregexp psz exp m rgx reg comp psz exp cdiffcontext setregexp pszexp m_strregexp pszexp m_rgx regcomp pszexp int64 ltime int64 rtime byte code diffitem di di sfilename psz filename di slpath psz left dir di srpath psz right dir di ltime ltime di rtime rtime di code code add diff di __int64 __int64 pszfilename pszleftdir pszrightdir adddiff void c diff context add diff diffitem di bsp capture the extension from the end of the file name to the last int j 0 tchar p dest tcsrchr di sfilename t if p dest handle no extensions case di sext p dest 1 skip dot di sext make lower m plist add tail di if m pistatus m pistatus rpt file di code cdiffcontext adddiff pdest _tcsrchr _t pdest pdest makelower m_plist addtail m_pistatus m_pistatus rptfile void c diff context remove diff position diffpos m plist remove at diffpos cdiffcontext removediff m_plist removeat void c diff context remove all m plist remove all cdiffcontext removeall m_plist removeall position c diff context get first diff position return m plist get head position cdiffcontext getfirstdiffposition m_plist getheadposition diffitem c diff context get next diff position position diffpos return m plist get next diffpos cdiffcontext getnextdiffposition m_plist getnext diffitem c diff context get diff at position diffpos return m plist get at diffpos cdiffcontext getdiffat m_plist getat byte c diff context get diff status position diffpos return m plist get at diffpos code cdiffcontext getdiffstatus m_plist getat int c diff context get diff count return m plist get count cdiffcontext getdiffcount m_plist getcount void c diff context update status code position diffpos byte status diffitem di m plist get at diffpos di code status cdiffcontext updatestatuscode m_plist getat void c diff context update times position diffpos long left time long right time diffitem di m plist get at diffpos if left time di ltime left time if right time di rtime right time cdiffcontext updatetimes lefttime righttime m_plist getat lefttime lefttime righttime righttime c about dlg c about dlg c dialog c about dlg idd afx data init c about dlg m strversion t afx data init caboutdlg caboutdlg cdialog caboutdlg afx_data_init caboutdlg m_strversion _t afx_data_init void c about dlg do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c about dlg ddx control pdx idc company m ctlcompany ddx control pdx idc www m ctlwww ddx text pdx idc version m strversion afx data map caboutdlg dodataexchange cdataexchange cdialog dodataexchange afx_data_map caboutdlg ddx_control idc_company m_ctlcompany ddx_control idc_www m_ctlwww ddx_text idc_version m_strversion afx_data_map bool c about dlg on init dialog c dialog on init dialog c version info version c string s version version get fixed product version afx format string1 m strversion ids version fmt s version m ctlcompany set window text version get legal copyright m ctlwww m link t http winmerge sourceforge net update data false return true return true unless you set the focus to a control exception ocx property pages should return false caboutdlg oninitdialog cdialog oninitdialog cversioninfo cstring sversion getfixedproductversion afxformatstring1 m_strversion ids_version_fmt sversion m_ctlcompany setwindowtext getlegalcopyright m_ctlwww m_link _t updatedata