c most recent urls c most recent urls m hmutex create mutex null false null loadur ls cmostrecenturls cmostrecenturls m_hmutex createmutex loadurls c most recent urls c most recent urls saveur ls deleteur ls cmostrecenturls cmostrecenturls saveurls deleteurls void c most recent urls loadur ls dword dw wait result do dw wait result wait for single object m hmutex 1000l sleep 1 while dw wait result wait object 0 m maxurls the app preferences get int kmeleon mru maxur ls 16 if m maxurls 0 m maxurls 0 m urlcount 0 m urls null release mutex m hmutex return m urls new char m maxurls char s pref 20 kmeleon mru url s buf 5 char s count s pref strlen s pref int x 0 int y 0 do itoa x s buf 10 strcpy s count s buf create kmeleon mru url string int len the app preferences get string s pref null if len 0 m urls y new char len 1 the app preferences get string s pref m urls y y while x m maxurls m urlcount y nullify the empty entries for y m maxurls y m urls y null release mutex m hmutex cmostrecenturls loadurls dwwaitresult dwwaitresult waitforsingleobject m_hmutex dwwaitresult wait_object_0 m_maxurls theapp getint maxurls m_maxurls m_maxurls m_urlcount m_urls releasemutex m_hmutex m_urls m_maxurls spref sbuf scount spref spref sbuf scount sbuf theapp getstring spref m_urls theapp getstring spref m_urls m_maxurls m_urlcount m_maxurls m_urls releasemutex m_hmutex void c most recent urls saveur ls if m maxurls 1 return dword dw wait result do dw wait result wait for single object m hmutex 1000l sleep 1 while dw wait result wait object 0 char s pref 20 kmeleon mru url s buf 5 char s count s pref strlen s pref the app preferences set int kmeleon mru maxur ls m maxurls int y 0 for int x 0 x m urlcount x itoa y s buf 10 strcpy s count s buf create kmeleon mru url string if strlen m urls x 0 the app preferences set string s pref m urls x y release mutex m hmutex cmostrecenturls saveurls m_maxurls dwwaitresult dwwaitresult waitforsingleobject m_hmutex dwwaitresult wait_object_0 spref sbuf scount spref spref theapp setint maxurls m_maxurls m_urlcount sbuf scount sbuf m_urls theapp setstring spref m_urls releasemutex m_hmutex void c most recent urls deleteur ls dword dw wait result do dw wait result wait for single object m hmutex 1000l sleep 1 while dw wait result wait object 0 for int x 0 x m maxurls x if m urls x delete m urls x delete m urls release mutex m hmutex cmostrecenturls deleteurls dwwaitresult dwwaitresult waitforsingleobject m_hmutex dwwaitresult wait_object_0 m_maxurls m_urls m_urls m_urls releasemutex m_hmutex void c most recent urls refreshur ls deleteur ls loadur ls cmostrecenturls refreshurls deleteurls loadurls char c most recent urls geturl int a inx if a inx m urlcount return m urls a inx return null cmostrecenturls ainx ainx m_urlcount m_urls ainx void c most recent urls addurl const char aurl if m maxurls 1 return dword dw wait result do dw wait result wait for single object m hmutex 1000l sleep 1 while dw wait result wait object 0 check list for previous entry for int x 0 x m urlcount 1 x if m urls x if strcmp m urls x aurl 0 break if no match if x m urlcount 1 m urlcount 0 if m urlcount m maxurls delete m urls x if list is full remove the bottom entry else otherwise add a new entry and increase the count m urlcount x shift everything down while x m urls x m urls x 1 x add the new url m urls 0 strdup aurl release mutex m hmutex cmostrecenturls m_maxurls dwwaitresult dwwaitresult waitforsingleobject m_hmutex dwwaitresult wait_object_0 m_urlcount m_urls m_urls m_urlcount m_urlcount m_urlcount m_maxurls m_urls m_urlcount m_urls m_urls m_urls _strdup releasemutex m_hmutex c browser impl c browser impl ns init isupports m pbrowserframeglue null m web browser nsnull cbrowserimpl cbrowserimpl ns_init_isupports m_pbrowserframeglue mwebbrowser c browser impl c browser impl cbrowserimpl cbrowserimpl bool c find dialog wrap around c button p chk c button get dlg item idc wrap around return p chk p chk get check false cfinddialog wraparound cbutton pchk cbutton getdlgitem idc_wrap_around pchk pchk getcheck bool c find dialog search backwards c button p chk c button get dlg item idc search backwards return p chk p chk get check false cfinddialog searchbackwards cbutton pchk cbutton getdlgitem idc_search_backwards pchk pchk getcheck void c find dialog on cancel c button p chk c button get dlg item idc match case if p chk the app preferences b find match case p chk get check p chk c button get dlg item idc wrap around if p chk the app preferences b find wrap around p chk get check p chk c button get dlg item idc search backwards if p chk the app preferences b find search backwards p chk get check c find replace dialog on cancel cfinddialog oncancel cbutton pchk cbutton getdlgitem idc_match_case pchk theapp bfindmatchcase pchk getcheck pchk cbutton getdlgitem idc_wrap_around pchk theapp bfindwraparound pchk getcheck pchk cbutton getdlgitem idc_search_backwards pchk theapp bfindsearchbackwards pchk getcheck cfindreplacedialog oncancel void c find dialog post nc destroy let the owner know we re gone if m powner null m powner clear find dialog c find replace dialog post nc destroy cfinddialog postncdestroy m_powner m_powner clearfinddialog cfindreplacedialog postncdestroy m bhascheckbox b has check if p title m csdialogtitle p title if p text m csprompttext p text if p init prompt text m cspromptanswer p init prompt text if p check text m cscheckboxtext p check text m_bhascheckbox bhascheck ptitle m_csdialogtitle ptitle ptext m_csprompttext ptext pinitprompttext m_cspromptanswer pinitprompttext pchecktext m_cscheckboxtext pchecktext void c prompt dialog do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c prompt dialog ddx text pdx idc prompt answer m cspromptanswer ddx check pdx idc check save password m bcheckboxvalue afx data map cpromptdialog dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpromptdialog ddx_text idc_prompt_answer m_cspromptanswer ddx_check idc_check_save_password m_bcheckboxvalue afx_data_map int c prompt dialog on init dialog set window text m csdialogtitle c wnd p wnd get dlg item idc prompt text if p wnd p wnd set window text m csprompttext c button p chk c button get dlg item idc check save password if p chk if m bhascheckbox if m cscheckboxtext is empty p chk set window text m cscheckboxtext p chk set check m bcheckboxvalue bst checked bst unchecked else hide the check box control if there s no label text this will be the case when we re not using single sign on p chk show window sw hide c edit p edit c edit get dlg item idc prompt answer if p edit p edit set window text m cspromptanswer p edit set focus p edit set sel 0 1 return 0 returning 0 since we re explicitly setting focus return true cpromptdialog oninitdialog setwindowtext m_csdialogtitle cwnd pwnd getdlgitem idc_prompt_text pwnd pwnd setwindowtext m_csprompttext cbutton pchk cbutton getdlgitem idc_check_save_password pchk m_bhascheckbox m_cscheckboxtext isempty pchk setwindowtext m_cscheckboxtext pchk setcheck m_bcheckboxvalue bst_checked bst_unchecked pchk showwindow sw_hide cedit pedit cedit getdlgitem idc_prompt_answer pedit pedit setwindowtext m_cspromptanswer pedit setfocus pedit setsel m bhascheckbox b has check m bcheckboxvalue init check val if p title m csdialogtitle p title if p text m csprompttext p text if p init password text m cspassword p init password text if p check text m cscheckboxtext p check text m_bhascheckbox bhascheck m_bcheckboxvalue initcheckval ptitle m_csdialogtitle ptitle ptext m_csprompttext ptext pinitpasswordtext m_cspassword pinitpasswordtext pchecktext m_cscheckboxtext pchecktext void c prompt password dialog do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c prompt password dialog ddx text pdx idc password m cspassword ddx check pdx idc check save password m bcheckboxvalue afx data map cpromptpassworddialog dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpromptpassworddialog ddx_text idc_password m_cspassword ddx_check idc_check_save_password m_bcheckboxvalue afx_data_map int c prompt password dialog on init dialog set window text m csdialogtitle c wnd p wnd get dlg item idc prompt text if p wnd p wnd set window text m csprompttext c button p chk c button get dlg item idc check save password if p chk if m bhascheckbox if m cscheckboxtext is empty p chk set window text m cscheckboxtext p chk set check m bcheckboxvalue bst checked bst unchecked else hide the check box control if there s no label text this will be the case when we re not using single sign on p chk show window sw hide c edit p edit c edit get dlg item idc password if p edit p edit set focus return 0 returning 0 since we re explicitly setting focus return true cpromptpassworddialog oninitdialog setwindowtext m_csdialogtitle cwnd pwnd getdlgitem idc_prompt_text pwnd pwnd setwindowtext m_csprompttext cbutton pchk cbutton getdlgitem idc_check_save_password pchk m_bhascheckbox m_cscheckboxtext isempty pchk setwindowtext m_cscheckboxtext pchk setcheck m_bcheckboxvalue bst_checked bst_unchecked pchk showwindow sw_hide cedit pedit cedit getdlgitem idc_password pedit pedit setfocus m bhascheckbox b has check m bcheckboxvalue init check val if p title m csdialogtitle p title if p text m csprompttext p text if p init username m csusername p init username if p init password m cspassword p init password if p check text m cscheckboxtext p check text m_bhascheckbox bhascheck m_bcheckboxvalue initcheckval ptitle m_csdialogtitle ptitle ptext m_csprompttext ptext pinitusername m_csusername pinitusername pinitpassword m_cspassword pinitpassword pchecktext m_cscheckboxtext pchecktext void c prompt username password dialog do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c prompt username password dialog ddx text pdx idc username m csusername ddx text pdx idc password m cspassword ddx check pdx idc check save password m bcheckboxvalue afx data map cpromptusernamepassworddialog dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpromptusernamepassworddialog ddx_text idc_username m_csusername ddx_text idc_password m_cspassword ddx_check idc_check_save_password m_bcheckboxvalue afx_data_map int c prompt username password dialog on init dialog set window text m csdialogtitle c wnd p wnd get dlg item idc prompt text if p wnd p wnd set window text m csprompttext c button p chk c button get dlg item idc check save password if p chk if m bhascheckbox if m cscheckboxtext is empty p chk set window text m cscheckboxtext p chk set check m bcheckboxvalue bst checked bst unchecked else p chk show window sw hide c edit p edit c edit get dlg item idc password if p edit p edit set window text m cspassword p edit c edit get dlg item idc username if p edit p edit set window text m csusername p edit set sel 0 1 p edit set focus return 0 returning 0 since we re explicitly setting focus return true cpromptusernamepassworddialog oninitdialog setwindowtext m_csdialogtitle cwnd pwnd getdlgitem idc_prompt_text pwnd pwnd setwindowtext m_csprompttext cbutton pchk cbutton getdlgitem idc_check_save_password pchk m_bhascheckbox m_cscheckboxtext isempty pchk setwindowtext m_cscheckboxtext pchk setcheck m_bcheckboxvalue bst_checked bst_unchecked pchk showwindow sw_hide cedit pedit cedit getdlgitem idc_password pedit pedit setwindowtext m_cspassword pedit cedit getdlgitem idc_username pedit pedit setwindowtext m_csusername pedit setsel pedit setfocus c dialog c alert check dialog idd p parent if p title m csdialogtitle p title if p text m csmsgtext p text if p check text m cscheckboxtext p check text m bcheckboxvalue init check val cdialog calertcheckdialog pparent ptitle m_csdialogtitle ptitle ptext m_csmsgtext ptext pchecktext m_cscheckboxtext pchecktext m_bcheckboxvalue initcheckval void c alert check dialog do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c alert check dialog ddx check pdx idc checkbox m bcheckboxvalue afx data map calertcheckdialog dodataexchange cdataexchange cdialog dodataexchange afx_data_map calertcheckdialog ddx_check idc_checkbox m_bcheckboxvalue afx_data_map int c alert check dialog on init dialog set window text m csdialogtitle c wnd p wnd get dlg item idc msg text if p wnd p wnd set window text m csmsgtext c button p chk c button get dlg item idc checkbox if p chk p chk set window text m cscheckboxtext p chk set check m bcheckboxvalue bst checked bst unchecked return true calertcheckdialog oninitdialog setwindowtext m_csdialogtitle cwnd pwnd getdlgitem idc_msg_text pwnd pwnd setwindowtext m_csmsgtext cbutton pchk cbutton getdlgitem idc_checkbox pchk pchk setwindowtext m_cscheckboxtext pchk setcheck m_bcheckboxvalue bst_checked bst_unchecked c dialog c confirm check dialog idd p parent if p title m csdialogtitle p title if p text m csmsgtext p text if p check text m cscheckboxtext p check text m bcheckboxvalue init check val if p btn1 text m csbtn1text p btn1 text if p btn2 text m csbtn2text p btn2 text if p btn3 text m csbtn3text p btn3 text cdialog cconfirmcheckdialog pparent ptitle m_csdialogtitle ptitle ptext m_csmsgtext ptext pchecktext m_cscheckboxtext pchecktext m_bcheckboxvalue initcheckval pbtn1text m_csbtn1text pbtn1text pbtn2text m_csbtn2text pbtn2text pbtn3text m_csbtn3text pbtn3text void c confirm check dialog do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c confirm check dialog ddx check pdx idc checkbox m bcheckboxvalue afx data map cconfirmcheckdialog dodataexchange cdataexchange cdialog dodataexchange afx_data_map cconfirmcheckdialog ddx_check idc_checkbox m_bcheckboxvalue afx_data_map int c confirm check dialog on init dialog set window text m csdialogtitle c wnd p wnd get dlg item idc msg text if p wnd p wnd set window text m csmsgtext c button p chk c button get dlg item idc checkbox if p chk if m cscheckboxtext is empty p chk show window sw hide else p chk set window text m cscheckboxtext p chk set check m bcheckboxvalue bst checked bst unchecked c button p btn1 c button get dlg item idc btn1 if p btn1 if m csbtn1text is empty p btn1 show window sw hide else p btn1 set window text m csbtn1text c button p btn2 c button get dlg item idc btn2 if p btn2 if m csbtn2text is empty p btn2 show window sw hide else p btn2 set window text m csbtn2text c button p btn3 c button get dlg item idc btn3 if p btn3 if m csbtn3text is empty p btn3 show window sw hide else p btn3 set window text m csbtn3text return true cconfirmcheckdialog oninitdialog setwindowtext m_csdialogtitle cwnd pwnd getdlgitem idc_msg_text pwnd pwnd setwindowtext m_csmsgtext cbutton pchk cbutton getdlgitem idc_checkbox pchk m_cscheckboxtext isempty pchk showwindow sw_hide pchk setwindowtext m_cscheckboxtext pchk setcheck m_bcheckboxvalue bst_checked bst_unchecked cbutton pbtn1 cbutton getdlgitem idc_btn1 pbtn1 m_csbtn1text isempty pbtn1 showwindow sw_hide pbtn1 setwindowtext m_csbtn1text cbutton pbtn2 cbutton getdlgitem idc_btn2 pbtn2 m_csbtn2text isempty pbtn2 showwindow sw_hide pbtn2 setwindowtext m_csbtn2text cbutton pbtn3 cbutton getdlgitem idc_btn3 pbtn3 m_csbtn3text isempty pbtn3 showwindow sw_hide pbtn3 setwindowtext m_csbtn3text void c confirm check dialog on btn1 clicked update data end dialog 0 where 0 indicates that the btn pressed was at index 0 cconfirmcheckdialog onbtn1clicked updatedata enddialog void c confirm check dialog on btn2 clicked update data end dialog 1 where 1 indicates that the btn pressed was at index 1 cconfirmcheckdialog onbtn2clicked updatedata enddialog void c confirm check dialog on btn3 clicked update data end dialog 2 where 2 indicates that the btn pressed was at index 2 cconfirmcheckdialog onbtn3clicked updatedata enddialog void c preference page do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c preference page switch idd case idd preferences display ddx radio pdx idc radio start blank the app preferences b start home ddx text pdx idc edit homepage the app preferences home page ddx text pdx idc edit toolbar background the app preferences toolbar background ddx check pdx idc check toolbar background the app preferences b toolbar background ddx radio pdx idc radio newwindow the app preferences i new window open as ddx text pdx idc edit url the app preferences new windowurl break case idd preferences general ddx check pdx idc check javascript the app preferences b javascript enabled ddx check pdx idc check java the app preferences b java enabled ddx check pdx idc check passwords the app preferences b remember signons ddx text pdx idc edit http the app preferences http version ddx text pdx idc edit settings dir the app preferences settings dir ddx text pdx idc edit plugins dir the app preferences plugins dir ddx check pdx idc check source enabled the app preferences b source use external command ddx text pdx idc edit source command the app preferences source command ddx check pdx idc check disableresize the app preferences b disable resize break case idd preferences proxy ddx text pdx idc edit http proxy the app preferences proxyhttp ddx text pdx idc edit http proxy port the app preferences proxyhttp port ddx text pdx idc edit ftp proxy the app preferences proxyftp ddx text pdx idc edit ftp proxy port the app preferences proxyftp port ddx text pdx idc edit ssl proxy the app preferences proxyssl ddx text pdx idc edit ssl proxy port the app preferences proxyssl port ddx text pdx idc edit gopher proxy the app preferences proxy gopher ddx text pdx idc edit gopher proxy port the app preferences proxy gopher port ddx text pdx idc edit socks proxy the app preferences proxysocks ddx text pdx idc edit socks proxy port the app preferences proxysocks port ddx radio pdx idc radio socks the app preferences proxysocks radio ddx text pdx idc edit proxy auto the app preferences proxy autourl ddx text pdx idc edit proxy no proxy the app preferences proxy no proxy ddx radio pdx idc radio proxy the app preferences proxy type break case idd preferences cache ddx text pdx idc edit memory cache the app preferences cache memory ddx text pdx idc edit disk cache the app preferences cache disk ddx text pdx idc edit cache directory the app preferences cache dir ddx radio pdx idc radio cache the app preferences cache check frequency break case idd preferences privacy ddx check pdx idc check animations the app preferences b animations enabled ddx radio pdx idc images all the app preferences i images enabled ddx radio pdx idc cookies all the app preferences i cookies enabled ddx check pdx idc check load the app preferences b disable popups on load ddx text pdx idc edit useragent the app preferences user agent break afx data map cpreferencepage dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpreferencepage idd_preferences_display ddx_radio idc_radio_start_blank theapp bstarthome ddx_text idc_edit_homepage theapp homepage ddx_text idc_edit_toolbar_background theapp toolbarbackground ddx_check idc_check_toolbar_background theapp btoolbarbackground ddx_radio idc_radio_newwindow theapp inewwindowopenas ddx_text idc_edit_url theapp newwindowurl idd_preferences_general ddx_check idc_check_javascript theapp bjavascriptenabled ddx_check idc_check_java theapp bjavaenabled ddx_check idc_check_passwords theapp bremembersignons ddx_text idc_edit_http theapp httpversion ddx_text idc_edit_settings_dir theapp settingsdir ddx_text idc_edit_plugins_dir theapp pluginsdir ddx_check idc_check_source_enabled theapp bsourceuseexternalcommand ddx_text idc_edit_source_command theapp sourcecommand ddx_check idc_check_disableresize theapp bdisableresize idd_preferences_proxy ddx_text idc_edit_http_proxy theapp ddx_text idc_edit_http_proxy_port theapp proxyhttpport ddx_text idc_edit_ftp_proxy theapp ddx_text idc_edit_ftp_proxy_port theapp proxyftpport ddx_text idc_edit_ssl_proxy theapp ddx_text idc_edit_ssl_proxy_port theapp proxysslport ddx_text idc_edit_gopher_proxy theapp proxygopher ddx_text idc_edit_gopher_proxy_port theapp proxygopherport ddx_text idc_edit_socks_proxy theapp ddx_text idc_edit_socks_proxy_port theapp proxysocksport ddx_radio idc_radio_socks theapp proxysocksradio ddx_text idc_edit_proxy_auto theapp proxyautourl ddx_text idc_edit_proxy_no_proxy theapp proxynoproxy ddx_radio idc_radio_proxy theapp proxytype idd_preferences_cache ddx_text idc_edit_memory_cache theapp cachememory ddx_text idc_edit_disk_cache theapp cachedisk ddx_text idc_edit_cache_directory theapp cachedir ddx_radio idc_radio_cache theapp cachecheckfrequency idd_preferences_privacy ddx_check idc_check_animations theapp banimationsenabled ddx_radio idc_images_all theapp iimagesenabled ddx_radio idc_cookies_all theapp icookiesenabled ddx_check idc_check_load theapp bdisablepopupsonload ddx_text idc_edit_useragent theapp useragent afx_data_map bool c preference page on init dialog switch idd case idd preferences privacy char buf 256 uabuf 256 pref 34 int x 1 y index 0 send dlg item message idc combo cb addstring 0 long default do sprintf pref kmeleon privacy useragent d name x the app preferences get string pref buf if buf send dlg item message idc combo cb addstring 0 long buf x while buf the app preferences get string general useragent override uabuf if uabuf for y 1 y x y sprintf pref kmeleon privacy useragent d string y the app preferences get string pref buf if strcmp buf uabuf 0 index y send dlg item message idc combo cb setcursel index 0 break case idd preferences display int i 0 index 0 win32 find data ffd c string fname the app preferences skins dir handle h find find first file fname get buffer 0 ffd if h find invalid handle value fname the app preferences skins current fname fname left fname get length 1 do if ffd dw file attributes file attribute directory ffd c file name 0 send dlg item message idc combo skin cb addstring 0 long ffd c file name if fname compare no case ffd c file name 0 index i i while find next file h find ffd find close h find send dlg item message idc combo skin cb setcursel index 0 break c dialog on init dialog return false return true unless you set the focus to a control cpreferencepage oninitdialog idd_preferences_privacy senddlgitemmessage idc_combo cb_addstring theapp getstring senddlgitemmessage idc_combo cb_addstring theapp getstring theapp getstring senddlgitemmessage idc_combo cb_setcursel idd_preferences_display win32_find_data cstring theapp skinsdir hfind findfirstfile getbuffer hfind invalid_handle_value theapp skinscurrent getlength dwfileattributes file_attribute_directory cfilename senddlgitemmessage idc_combo_skin cb_addstring cfilename comparenocase cfilename findnextfile hfind findclose hfind senddlgitemmessage idc_combo_skin cb_setcursel cdialog oninitdialog void c preference page on clear disk cache nsresult rv nscom ptr nsi cache service cache service do getservice ns cacheservice contractid rv if ns failed rv return cache service evict entries nsi cache store anywhere cache service evict entries nsi cache store in memory cache service evict entries nsi cache store on disk cache service evict entries nsi cache store on disk as file cpreferencepage oncleardiskcache nscomptr nsicacheservice cacheservice do_getservice ns_cacheservice_contractid ns_failed cacheservice evictentries nsicache store_anywhere cacheservice evictentries nsicache store_in_memory cacheservice evictentries nsicache store_on_disk cacheservice evictentries nsicache store_on_disk_as_file void c preference page on clear mem cache nsresult rv nscom ptr nsi cache service cache service do getservice ns cacheservice contractid rv if ns failed rv return cache service evict entries nsi cache store in memory cpreferencepage onclearmemcache nscomptr nsicacheservice cacheservice do_getservice ns_cacheservice_contractid ns_failed cacheservice evictentries nsicache store_in_memory void c preference page on browse c string oldstr openfilename ofn char sz file name new char internet max url length memset ofn 0 sizeof ofn memset sz file name 0 internet max url length ofn l struct size sizeof ofn ofn lpstr file sz file name ofn n max file internet max url length ofn flags ofn hidereadonly switch idd case idd preferences display ofn lpstr filter bitmaps 0 bmp 0 0 get open file name ofn the app preferences toolbar background sz file name update data false break case idd preferences general ofn lpstr filter executable files 0 exe 0 0 get open file name ofn oldstr the app preferences source command the app preferences source command sz file name if the app preferences source command if oldstr the app preferences source command the app preferences b source use external command true else if oldstr the app preferences source command oldstr update data false break delete sz file name cpreferencepage onbrowse cstring szfilename internet_max_url_length szfilename internet_max_url_length lstructsize lpstrfile szfilename nmaxfile internet_max_url_length ofn_hidereadonly idd_preferences_display lpstrfilter getopenfilename theapp toolbarbackground szfilename updatedata idd_preferences_general lpstrfilter getopenfilename theapp sourcecommand theapp sourcecommand szfilename theapp sourcecommand theapp sourcecommand theapp bsourceuseexternalcommand theapp sourcecommand updatedata szfilename void c preference page on combo changed switch idd case idd preferences privacy int index char buf 256 pref 34 index send dlg item message idc combo cb getcursel 0 0 if index 0 the app preferences get string general useragent override buf buf 0 else sprintf pref kmeleon privacy useragent d string index the app preferences get string pref buf if buf set dlg item text idc edit useragent buf else set dlg item text idc edit useragent break case idd preferences display int index char buf 256 index send dlg item message idc combo skin cb getcursel 0 0 if index cb err send dlg item message idc combo skin cb getlbtext index lparam buf the app preferences skins current buf the app preferences skins current the app preferences skins current break cpreferencepage oncombochanged idd_preferences_privacy senddlgitemmessage idc_combo cb_getcursel theapp getstring theapp getstring setdlgitemtext idc_edit_useragent setdlgitemtext idc_edit_useragent idd_preferences_display senddlgitemmessage idc_combo_skin cb_getcursel cb_err senddlgitemmessage idc_combo_skin cb_getlbtext theapp skinscurrent theapp skinscurrent theapp skinscurrent these are here to cancel the effects of hitting enter esc void c preference page onok cpreferencepage void c preference page on cancel cpreferencepage oncancel void c preference page plugins do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c preference page plugins ddx control pdx idc list plugins m pluginlist afx data map cpreferencepageplugins dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpreferencepageplugins ddx_control idc_list_plugins m_pluginlist afx_data_map bool c preference page plugins on init dialog c dialog on init dialog rect rect m pluginlist set parent this m pluginlist get client rect rect m pluginlist insert column 0 blah lvcfmt left rect right position pos the app plugins plugin list get start position kmeleon plugin k plugin c string s m imagelist create 16 16 true 4 4 m imagelist add the app load icon idi off m imagelist add the app load icon idi on m imagelist add the app load icon idi offcheck m imagelist add the app load icon idi oncheck m pluginlist set image list m imagelist lvsil small while pos the app plugins plugin list get next assoc pos s k plugin int item m pluginlist get item count char preference 128 kmeleon plugins strcat preference k plugin dllname strcat preference load int image k plugin loaded if the app preferences get bool preference 1 image 2 m pluginlist insert item item k plugin description image m pluginlist set item state 0 lvis selected lvis focused lvis selected lvis focused return false return true unless you set the focus to a control cpreferencepageplugins oninitdialog cdialog oninitdialog m_pluginlist setparent m_pluginlist getclientrect m_pluginlist insertcolumn lvcfmt_left theapp pluginlist getstartposition kmeleonplugin kplugin cstring m_imagelist m_imagelist theapp loadicon idi_off m_imagelist theapp loadicon idi_on m_imagelist theapp loadicon idi_offcheck m_imagelist theapp loadicon idi_oncheck m_pluginlist setimagelist m_imagelist lvsil_small theapp pluginlist getnextassoc kplugin m_pluginlist getitemcount kplugin kplugin theapp getbool m_pluginlist insertitem kplugin m_pluginlist setitemstate lvis_selected lvis_focused lvis_selected lvis_focused void c preference page plugins on config int item position pos pos m pluginlist get first selected item position if pos return item m pluginlist get next selected item pos kmeleon plugin k plugin c string s pos the app plugins plugin list get start position while pos the app plugins plugin list get next assoc pos s k plugin if item 0 if k plugin loaded the app plugins send message k plugin dllname prefs page config long this m hwnd else afx message box ids plugin not loaded break item cpreferencepageplugins onconfig m_pluginlist getfirstselecteditemposition m_pluginlist getnextselecteditem kmeleonplugin kplugin cstring theapp pluginlist getstartposition theapp pluginlist getnextassoc kplugin kplugin theapp sendmessage kplugin m_hwnd afxmessagebox ids_plugin_not_loaded void c preference page plugins on enable int item position pos pos m pluginlist get first selected item position if pos return item m pluginlist get next selected item pos kmeleon plugin k plugin c string s pos the app plugins plugin list get start position int i item while pos the app plugins plugin list get next assoc pos s k plugin if i 0 char preference 128 kmeleon plugins strcat preference k plugin dllname strcat preference load the app preferences set bool preference the app preferences get bool preference 1 int image k plugin loaded if the app preferences get bool preference 1 image 2 m pluginlist set item item 0 lvif image null image null null null break i cpreferencepageplugins onenable m_pluginlist getfirstselecteditemposition m_pluginlist getnextselecteditem kmeleonplugin kplugin cstring theapp pluginlist getstartposition theapp pluginlist getnextassoc kplugin kplugin theapp setbool theapp getbool kplugin theapp getbool m_pluginlist setitem lvif_image void c preference page configs add tab const char label const char file const char help int new item m tabctrl get item count m tabctrl insert item new item label m configfiles insert at new item file cpreferencepageconfigs addtab newitem m_tabctrl getitemcount m_tabctrl insertitem newitem m_configfiles insertat newitem c preference page configs c preference page configs cpreferencepageconfigs cpreferencepageconfigs void c preference page configs do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c preference page plugins ddx text pdx idc edit1 m filetext ddx control pdx idc tab1 m tabctrl afx data map if pdx m bsaveandvalidate if send dlg item message idc edit1 em getmodify save file m configfiles m tabctrl get cur sel cpreferencepageconfigs dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpreferencepageplugins ddx_text idc_edit1 m_filetext ddx_control idc_tab1 m_tabctrl afx_data_map m_bsaveandvalidate senddlgitemmessage idc_edit1 em_getmodify savefile m_configfiles m_tabctrl getcursel bool c preference page configs on init dialog c dialog on init dialog c edit edit box c edit get dlg item idc edit1 edit box set tab stops 6 add tab menus the app preferences settings dir menus cfg add tab accelerators the app preferences settings dir accel cfg add tab prefs js the app preferences profile dir prefs js add tab user js the app preferences profile dir user js add tab user content css the app preferences profile dir chrome user content css if 0 config file type plugin config files 10 int num config files the app plugins get config files plugin config files 10 int i for i 0 i num config files i add tab plugin config files i label plugin config files i file plugin config files i help url endif show file m configfiles 0 return false return true unless you set the focus to a control cpreferencepageconfigs oninitdialog cdialog oninitdialog cedit editbox cedit getdlgitem idc_edit1 editbox settabstops addtab theapp settingsdir addtab theapp settingsdir addtab theapp profiledir addtab theapp profiledir addtab usercontent theapp profiledir usercontent configfiletype pluginconfigfiles numconfigfiles theapp getconfigfiles pluginconfigfiles numconfigfiles addtab pluginconfigfiles pluginconfigfiles pluginconfigfiles helpurl showfile m_configfiles void c preference page configs show file const char filename c file file if file open filename c file mode read ulonglong length file get length char buffer new char length 1 buffer file read buffer length 0 char p strchr buffer n if p p 1 r ulonglong i 1 while p strchr p 1 n i char buffer2 new char length i 1 char q buffer2 p buffer while p while p p n q p if p n q r q p q 0 delete buffer buffer buffer2 m converted true else m converted false m filetext buffer delete buffer update data false else message box error opening file file close cpreferencepageconfigs showfile cfile cfile moderead getlength m_converted m_converted m_filetext updatedata messagebox void c preference page configs save file const char filename const char pretty filename strrchr filename if pretty filename pretty filename hop over the else pretty filename filename if message box do you wish to save your changes pretty filename mb yesno idno return c file file if file open filename c file mode create c file mode write c file type binary binary is so write treats cr lf as 2 characters if m converted lptstr p m filetext get buffer m filetext get length lptstr q p while p while p p r q p if p r p q 0 m filetext release buffer m converted false file write m filetext m filetext get length file close if 1 if strstr filename prefs js nsresult rv nscom ptr nsi pref prefs do getservice ns pref contractid rv if ns succeeded rv nscom ptr nsi local file pref file do createinstance ns local file contractid rv pref file init with native path ns dependentc string filename prefs read user prefs pref file the app preferences load endif else message box error opening file cpreferencepageconfigs savefile prettyfilename prettyfilename prettyfilename prettyfilename messagebox prettyfilename mb_yesno cfile cfile modecreate cfile modewrite cfile typebinary m_converted m_filetext getbuffer m_filetext getlength m_filetext releasebuffer m_converted m_filetext m_filetext getlength nscomptr nsipref do_getservice ns_pref_contractid ns_succeeded nscomptr nsilocalfile preffile do_createinstance ns_local_file_contractid preffile initwithnativepath nsdependentcstring readuserprefs preffile theapp messagebox void c preference page configs on help message box somewhere on kmeleon org there should be a help file eventually the information will be here too cpreferencepageconfigs onhelp messagebox void c preference page configs on sel changing nmhdr nm hdr lresult result update data result false cpreferencepageconfigs onselchanging nmhdr updatedata void c preference page configs on sel change nmhdr nm hdr lresult result show file m configfiles m tabctrl get cur sel send dlg item message idc edit1 em setmodify 0 cpreferencepageconfigs onselchange nmhdr showfile m_configfiles m_tabctrl getcursel senddlgitemmessage idc_edit1 em_setmodify c preferences dlg c preferences dlg c dialog idd page null cpreferencesdlg cpreferencesdlg cdialog c preferences dlg c preferences dlg cpreferencesdlg cpreferencesdlg int c preferences dlg do modal int ret c dialog do modal if page delete page page null the app preferences save return ret cpreferencesdlg domodal cdialog domodal theapp bool c preferences dlg create c wnd p parent return false cpreferencesdlg cwnd pparent void c preferences dlg do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c preferences dlg ddx control pdx idc list1 m list afx data map cpreferencesdlg dodataexchange cdataexchange cdialog dodataexchange afx_data_map cpreferencesdlg ddx_control idc_list1 m_list afx_data_map c preferences dlg on init dialog c dialog on init dialog update data true rect rect m list set parent this m list get client rect rect m list insert column 0 blah lvcfmt left rect right add item t display idd preferences display add item t general idd preferences general add item t privacy idd preferences privacy add item t cache idd preferences cache add item t proxy idd preferences proxy add item t configs idd preferences configs add item t plugins idd preferences plugins m list set item state 0 lvis selected lvis focused lvis selected lvis focused return true return true unless you set the focus to a control cpreferencesdlg oninitdialog cdialog oninitdialog updatedata m_list setparent m_list getclientrect m_list insertcolumn lvcfmt_left additem _t idd_preferences_display additem _t idd_preferences_general additem _t idd_preferences_privacy additem _t idd_preferences_cache additem _t idd_preferences_proxy additem _t idd_preferences_configs additem _t idd_preferences_plugins m_list setitemstate lvis_selected lvis_focused lvis_selected lvis_focused void c preferences dlg on list select nmhdr pnmhdr lresult p result int item position pos pos m list get first selected item position if pos return item m list get next selected item pos uint idd m list get item data item show page idd cpreferencesdlg onlistselect presult m_list getfirstselecteditemposition m_list getnextselecteditem m_list getitemdata showpage void c preferences dlg onok if page page update data delete page page null c dialog onok cpreferencesdlg updatedata cdialog void c preferences dlg on cancel c dialog on cancel cpreferencesdlg oncancel cdialog oncancel void c preferences dlg show page uint idd if page if page idd idd return page update data delete page if idd idd preferences plugins page new c preference page plugins else if idd idd preferences configs page new c preference page configs else page new c preference page page idd idd page create idd this page set parent this rect rect c wnd container get dlg item idc container container get client rect rect container client to screen rect screen to client rect page move window rect page show window sw show cpreferencesdlg showpage updatedata idd_preferences_plugins cpreferencepageplugins idd_preferences_configs cpreferencepageconfigs cpreferencepage setparent cwnd getdlgitem idc_container getclientrect clienttoscreen screentoclient movewindow showwindow sw_show void c preferences dlg add item char text uint idd int item m list get item count m list insert item item text 0 m list set item data item idd cpreferencesdlg additem m_list getitemcount m_list insertitem m_list setitemdata static bool callback menu log proc hwnd hwnd dlg uint u msg wparam w param lparam l param if u msg wm initdialog c string log c log l param log set dlg item text hwnd dlg idc errors log set window text hwnd dlg c log l param title log return true else if u msg wm command if loword w param idok end dialog hwnd dlg 0 return true return false menulogproc hwnddlg umsg wparam lparam umsg wm_initdialog cstring clog lparam setdlgitemtext hwnddlg idc_errors setwindowtext hwnddlg clog lparam umsg wm_command wparam enddialog hwnddlg c log error 0 strict 0 verbose 0 clog verbose 0 c log clog void show if error strict verbose dialog box param afx get instance handle makeintresource idd errorbox null c log menu log proc lparam this error 0 dialogboxparam afxgetinstancehandle idd_errorbox clog menulogproc void write string const char string log string writestring void error error 1 char c parser strtok char string const char control if 0 char str const char ctrl control unsigned char map 32 int count clear control map for count 0 count 32 count map count 0 set bits in delimiter table do map ctrl 3 1 ctrl 7 while ctrl initialize str if string is null set str to the saved pointer i e continue breaking tokens out of the string from the last strtok call if string str string else str nextoken find beginning of token skip over leading delimiters note that there is no token iff this loop sets str to point to the terminal null str 0 while map str 3 1 str 7 str str string str find the end of the token if it is not the end of the string put a null there for str str if map str 3 1 str 7 str 0 break update nextoken nextoken str determine if a token has been found if string str return null else return string else if string nextoken string char tok if tok strstr nextoken control tok 0 char ret nextoken nextoken tok strlen control return ret else return 0 endif cparser int c menu parser parse char p if current menu there can only be 3 things outside a menu comments metacommands and the beginning of a menu block char cb strchr p if cb cb 0 p skip white space p trim white space p current menu new c menu if strstr p t main current menu create menu else current menu create popup menu c menu popup null if menus lookup c string p popup popup destroy menu delete popup menus p current menu log 1 created menu s p else p skip white space p trim white space p if p 0 p c menu popup null menus lookup c string p popup if popup current menu append menu mf popup mf string uint popup m hmenu p log 1 added popup s p else log error 1 popup s not found p else if p 0 p c menu popup null menus lookup c string p popup if popup int n popup get menu item count for int i 0 i n i menuiteminfo info info cb size sizeof menuiteminfo info f mask miim submenu popup get menu item info i info true uint id popup get menu itemid i c string str if popup get menu string i str mf byposition 0 if info h sub menu current menu append menu mf popup mf string uint info h sub menu str else current menu append menu mf string id str else current menu append menu mf separator else log error 1 popup s not found p else if p 0 current menu append menu mf separator log 1 added separator 0 else if p 0 current menu null log 1 ended menu 0 else if p 0 p p skip white space p trim white space p if strcmpi p tool bars 0 the app m toolbarcontrolsmenu current menu get safe hmenu if strcmpi p entry point 0 menu offsets current menu current menu get menu item count get system metrics sm cymenusize get system metrics sm cyedge else translate tabs p it s either a plugin or a menu item char op strchr p if op if there s an open parenthesis we ll assume it s a plugin char parameter op 1 char cp strrchr parameter if cp cp 0 op 0 trim white space p if the app plugins send message p menu parser do menu long current menu get safe hmenu long parameter log 2 called plugin s with parameter s p parameter else log error 1 plugin s has no menu p else char e strrchr p if e e 0 e skip white space e 1 int val val the app getid e if val val atoi e trim white space p current menu append menu mf string val p log 2 added menu item s with command d p val else log error 1 i don t know what to do with s p current menu return 1 cmenuparser currentmenu skipwhitespace trimwhitespace currentmenu cmenu _t currentmenu createmenu currentmenu createpopupmenu cmenu cstring destroymenu currentmenu log_1 skipwhitespace trimwhitespace cmenu cstring currentmenu appendmenu mf_popup mf_string m_hmenu log_1 log_error_1 cmenu cstring getmenuitemcount cbsize fmask miim_submenu getmenuiteminfo getmenuitemid cstring getmenustring mf_byposition hsubmenu currentmenu appendmenu mf_popup mf_string hsubmenu currentmenu appendmenu mf_string currentmenu appendmenu mf_separator log_error_1 currentmenu appendmenu mf_separator log_1 currentmenu log_1 skipwhitespace trimwhitespace toolbars theapp m_toolbarcontrolsmenu currentmenu getsafehmenu entrypoint menuoffsets currentmenu currentmenu getmenuitemcount getsystemmetrics sm_cymenusize getsystemmetrics sm_cyedge translatetabs trimwhitespace theapp sendmessage menuparser domenu currentmenu getsafehmenu log_2 log_error_1 skipwhitespace theapp trimwhitespace currentmenu appendmenu mf_string log_2 log_error_1 currentmenu c menu parser c menu parser cmenuparser cmenuparser c menu parser c menu parser c string filename load filename cmenuparser cmenuparser cstring c menu parser c menu parser destroy cmenuparser cmenuparser int c menu parser load c string filename setup log menu int ret val c parser load filename end log return ret val cmenuparser cstring setup_log retval cparser end_log retval void c menu parser destroy position pos menus get start position c menu m c string s while pos menus get next assoc pos s m if m m destroy menu delete m menus remove all cmenuparser getstartposition cmenu cstring getnextassoc destroymenu removeall c menu c menu parser get menu char menu name c menu menu if menus lookup menu name menu return null return menu cmenu cmenuparser getmenu menuname cmenu menuname int c menu parser get offset c menu menu int offset if menu offsets lookup menu offset return 0 return offset cmenuparser getoffset cmenu menuoffsets void c menu parser set check uint id bool checked position pos menus get start position c menu m c string s while pos menus get next assoc pos s m if m m check menu item id mf bycommand checked mf checked mf unchecked cmenuparser setcheck getstartposition cmenu cstring getnextassoc checkmenuitem mf_bycommand mf_checked mf_unchecked c accel parser c accel parser accel table null num accelerators 0 memset accelerators 0 sizeof accel max accel numm keys 0 memset mouse 0 sizeof accel max mouse caccelparser caccelparser acceltable numaccelerators max_accel nummkeys max_mouse c accel parser c accel parser c string filename accel table null num accelerators 0 memset accelerators 0 sizeof accel max accel load filename caccelparser caccelparser cstring acceltable numaccelerators max_accel c accel parser c accel parser if accel table destroy accelerator table accel table caccelparser caccelparser acceltable destroyacceleratortable acceltable int c accel parser load c string filename setup log accel if accel table destroy accelerator table accel table accel table null num accelerators 0 int ret val c parser load filename end log return ret val caccelparser cstring setup_log acceltable destroyacceleratortable acceltable acceltable numaccelerators retval cparser end_log retval int c accel parser parse char p char e s char alt ctrl shift byte virt int command int key bool vkey modifiers key command e strchr p if e e 0 e e skip white space e trim white space e char op strchr e if op if there s an open parenthesis we ll assume it s a plugin char parameter op 1 char cp strrchr parameter if cp cp 0 op 0 trim white space e if the app plugins send message e accel parser do accel long parameter long command log 2 called plugin s with parameter s e parameter else log error 2 plugin s has no accelerator s e parameter else command the app getid e if command command atoi e trim white space p s p virt 0 alt strstr s alt if alt virt falt p alt 3 ctrl strstr s ctrl if ctrl virt fcontrol if ctrl alt p ctrl 4 shift strstr s shift if shift virt fshift if shift alt shift ctrl p shift 5 virt fvirtkey by now p should be past the modifiers and point to key p skip white space p if strncmp p vk 3 0 p 3 key 0 vkey true these should be in order of frequency of use to speed up parsing begin vk test vk test escape vk test left vk test right vk test f1 vk test f2 vk test f3 vk test f4 vk test f5 vk test f6 vk test f7 vk test f8 vk test f9 vk test f10 vk test f11 vk test f12 vk test home vk test end vk test prior page up vk test next page down vk test page up vk test page down vk test up vk test down vk test insert vk test delete vk test space vk test help vk test execute vk test select vk test print vk test snapshot print screen vk test plus vk test minus vk test comma vk test period vk test equals vk test back vk test tab vk test clear vk test return vk test multiply vk test add vk test subtract vk test decimal vk test divide vk test separator vk test pause vk test capital vk test menu vk test kana vk test junja vk test final vk test hanja vk test kanji vk test convert vk test nonconvert vk test accept vk test modechange vk test lwin vk test rwin vk test apps vk test numpad0 vk test numpad1 vk test numpad2 vk test numpad3 vk test numpad4 vk test numpad5 vk test numpad6 vk test numpad7 vk test numpad8 vk test numpad9 vk test f13 vk test f14 vk test f15 vk test f16 vk test f17 vk test f18 vk test f19 vk test f20 vk test f21 vk test f22 vk test f23 vk test f24 vk test numlock vk test scroll else if stricmp p l button 0 mouse numm keys cmd command mouse numm keys f virt virt fvirtkey mouse numm keys key wm lbuttondown numm keys return true else if stricmp p m button 0 mouse numm keys cmd command mouse numm keys f virt virt fvirtkey mouse numm keys key wm mbuttondown numm keys return true else if stricmp p r button 0 mouse numm keys cmd command mouse numm keys f virt virt fvirtkey mouse numm keys key wm rbuttondown numm keys return true else regular key key word p vkey false accelerators num accelerators cmd command accelerators num accelerators f virt virt if vkey key a key z key a key z accelerators num accelerators key key else accelerators num accelerators key vk key scan key num accelerators if e return true caccelparser skipwhitespace trimwhitespace trimwhitespace theapp sendmessage accelparser doaccel log_2 log_error_2 theapp trimwhitespace skipwhitespace vk_ begin_vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test page_up vk_test page_down vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test vk_test lbutton nummkeys nummkeys fvirt nummkeys wm_lbuttondown nummkeys mbutton nummkeys nummkeys fvirt nummkeys wm_mbuttondown nummkeys rbutton nummkeys nummkeys fvirt nummkeys wm_rbuttondown nummkeys numaccelerators numaccelerators fvirt numaccelerators numaccelerators vkkeyscan numaccelerators haccel c accel parser get table if accel table accel table create accelerator table accelerators num accelerators return accel table caccelparser gettable acceltable acceltable createacceleratortable numaccelerators acceltable int c accel parser check mouse uint message int i virt 0 if get key state vk shift 0 virt fshift if get key state vk control 0 virt fcontrol if get key state vk menu 0 virt falt for i 0 i numm keys i if mouse i key message if mouse i f virt virt return mouse i cmd return 0 caccelparser checkmouse getkeystate vk_shift getkeystate vk_control getkeystate vk_menu nummkeys fvirt c cmd line c cmd line m sprofilesdir null m bchrome false ccmdline ccmdline m_sprofilesdir m_bchrome c cmd line c cmd line if m sprofilesdir delete m sprofilesdir ccmdline ccmdline m_sprofilesdir m_sprofilesdir c cmd line initialize char cmd line int len m scmdline cmd line if get switch chrome null true 0 m bchrome true profiles dir directory or profiles dir appdata len get switch profiles dir null false if len 0 no arguments invalid get switch profiles dir null true remove from command line else if len 0 m sprofilesdir new char len 1 get switch profiles dir m sprofilesdir true if stricmp m sprofilesdir appdata delete m sprofilesdir m sprofilesdir new char max path itemidlist idl if sh get special folder location null csidl appdata idl noerror i malloc malloc sh get path fromid list idl m sprofilesdir sh get malloc malloc malloc free idl malloc release else get windows directory m sprofilesdir max path int len strlen m sprofilesdir if m sprofilesdir len 1 m sprofilesdir len m sprofilesdir len 1 0 strcat m sprofilesdir k meleon ccmdline cmdline m_scmdline cmdline getswitch m_bchrome profilesdir profilesdir getswitch profilesdir getswitch profilesdir m_sprofilesdir getswitch profilesdir m_sprofilesdir m_sprofilesdir m_sprofilesdir m_sprofilesdir max_path shgetspecialfolderlocation csidl_appdata imalloc shgetpathfromidlist m_sprofilesdir shgetmalloc getwindowsdirectory m_sprofilesdir max_path m_sprofilesdir m_sprofilesdir m_sprofilesdir m_sprofilesdir m_sprofilesdir kmeleon win embed file loc provider win embed file loc provider ns init isupports winembedfilelocprovider winembedfilelocprovider ns_init_isupports void cpop socket error char format char error 255 va list args va start args format vsprintf error format args va end args message box null error plugin name error 0 socketerror va_list va_start va_end messagebox plugin_name cpop if sock quit char cpop get sock data this little peek is here so we ll sit until we have data char peek 2 recv sock peek 1 msg peek unsigned long size ioctlsocket sock fionread size char buffer new char size 1 size recv sock buffer size 0 buffer size 0 return buffer getsockdata msg_peek int cpop setup struct sockaddr in cli addr sock socket pf inet sock stream 0 if sock invalid socket socket error invalid socket return 0 cli addr sin family af inet cli addr sin addr s addr inaddr any cli addr sin port 0 if bind sock lpsockaddr cli addr sizeof cli addr socket error socket error could not bind socket to address closesocket sock return 0 return 1 sockaddr_in cli_addr pf_inet sock_stream invalid_socket socketerror cli_addr sin_family af_inet cli_addr sin_addr s_addr inaddr_any cli_addr sin_port cli_addr cli_addr socket_error socketerror int cpop connect const char sz server name if sock socket error called connect without a valid socket struct sockaddr in srv addr lphostent host info host info gethostbyname sz server name if host info null socket error could not lookup hostname s sz server name closesocket sock return 0 srv addr sin family af inet casts are fun srv addr sin addr s un s addr unsigned long unsigned long host info h addr list srv addr sin port htons 110 110 pop if connect sock lpsockaddr srv addr sizeof srv addr socket error socket error could not connect to s sz server name closesocket sock return 0 return 1 szservername socketerror sockaddr_in srv_addr host_info host_info szservername host_info socketerror szservername srv_addr sin_family af_inet srv_addr sin_addr s_un s_addr host_info h_addr_list srv_addr sin_port srv_addr srv_addr socket_error socketerror szservername int cpop login const char sz username const char sz password if sock socket error called login without a valid socket c auto delete buffer buffer get initial server message buffer get sock data if buffer socket error server did not say hello closesocket sock return 0 send username char userline 256 sprintf userline user s n sz username send sock userline strlen userline 0 buffer get sock data if buffer socket error server did not like your username socket error server said s char buffer closesocket sock return 0 send password char passline 256 sprintf passline pass s n sz password send sock passline strlen passline 0 buffer get sock data if buffer socket error server did not like your password closesocket sock return 0 return 1 szusername szpassword socketerror cautodeletebuffer getsockdata socketerror szusername getsockdata socketerror socketerror szpassword getsockdata socketerror int cpop number of messages if sock socket error called number of messages without a valid socket c auto delete buffer buffer send sock stat n 5 0 buffer get sock data if buffer socket error server did send the proper stat reply closesocket sock return 0 else stat returns something like ok 1 819 the 4 jumps over the ok and atoi will stop parsing at the second space so we d return 1 return atoi buffer 4 numberofmessages socketerror numberofmessages cautodeletebuffer getsockdata socketerror int cpop quit if sock socket error called quit without a valid socket send sock quit n 5 0 closesocket sock sock null return 1 socketerror inline char operator char new buffer if buffer delete buffer buffer new buffer return buffer newbuffer newbuffer inline operator char return buffer inline char operator int index return buffer index public resource state m previous instance afx get resource handle afx set resource handle g instance resourcestate mpreviousinstance afxgetresourcehandle afxsetresourcehandle ginstance resource state afx set resource handle m previous instance resourcestate afxsetresourcehandle mpreviousinstance c dialog c new profile dlg idd p parent afx data init c new profile dlg m localeindex 1 m name t afx data init cdialog cnewprofiledlg pparent afx_data_init cnewprofiledlg m_localeindex m_name _t afx_data_init void c new profile dlg do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c new profile dlg ddx cbindex pdx idc locale combo m localeindex ddx text pdx idc new prof name m name afx data map pdx prepare edit ctrl idc new prof name if pdx m bsaveandvalidate validate profile name m name pdx cnewprofiledlg dodataexchange cdataexchange cdialog dodataexchange afx_data_map cnewprofiledlg ddx_cbindex idc_locale_combo m_localeindex ddx_text idc_new_prof_name m_name afx_data_map prepareeditctrl idc_new_prof_name m_bsaveandvalidate validateprofilename m_name c dialog c rename profile dlg idd p parent afx data init c rename profile dlg m newname t afx data init cdialog crenameprofiledlg pparent afx_data_init crenameprofiledlg m_newname _t afx_data_init void c rename profile dlg do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c rename profile dlg ddx text pdx idc new name m newname afx data map pdx prepare edit ctrl idc new name if pdx m bsaveandvalidate validate profile name m newname pdx crenameprofiledlg dodataexchange cdataexchange cdialog dodataexchange afx_data_map crenameprofiledlg ddx_text idc_new_name m_newname afx_data_map prepareeditctrl idc_new_name m_bsaveandvalidate validateprofilename m_newname c dialog c profiles dlg idd p parent afx data init c profiles dlg m batstartup false m baskatstartup false afx data init cdialog cprofilesdlg pparent afx_data_init cprofilesdlg m_batstartup m_baskatstartup afx_data_init void c profiles dlg do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c profiles dlg ddx control pdx idc list1 m profilelist ddx check pdx idc check ask at start m baskatstartup afx data map if pdx m bsaveandvalidate uses conversion int item index m profilelist get cur sel if item index lb err c string item text m profilelist get text item index item text m selectedprofile assign t2cw item text cprofilesdlg dodataexchange cdataexchange cdialog dodataexchange afx_data_map cprofilesdlg ddx_control idc_list1 m_profilelist ddx_check idc_check_ask_at_start m_baskatstartup afx_data_map m_bsaveandvalidate uses_conversion itemindex m_profilelist getcursel itemindex lb_err cstring itemtext m_profilelist gettext itemindex itemtext m_selectedprofile itemtext bool c profiles dlg on init dialog uses conversion c dialog on init dialog nsc auto string c str nsxpidl string cur profile name fill the list of profiles nsresult rv nscom ptr nsi profile profile service do getservice ns profile contractid rv profile service get current profile getter copies cur profile name pr int32 selected row 0 pr uint32 list len pr unichar profile list rv profile service get profile list list len profile list for pr uint32 index 0 index list len index c string tmp str w2t profile list index m profilelist add string tmp str if nscrt strcmp profile list index cur profile name get 0 selected row index m profilelist set cur sel selected row if m batstartup get dlg item idcancel enable window false return true return true unless you set the focus to a control exception ocx property pages should return false cprofilesdlg oninitdialog uses_conversion cdialog oninitdialog nscautostring cstr nsxpidlstring curprofilename nscomptr nsiprofile profileservice do_getservice ns_profile_contractid profileservice getcurrentprofile getter_copies curprofilename print32 selectedrow pruint32 listlen prunichar profilelist profileservice getprofilelist listlen profilelist pruint32 listlen cstring tmpstr profilelist m_profilelist addstring tmpstr profilelist curprofilename selectedrow m_profilelist setcursel selectedrow m_batstartup getdlgitem enablewindow void c profiles dlg on new profile c new profile dlg dialog if dialog do modal idok nsresult rv nscom ptr nsi profile profile service do getservice ns profile contractid rv assert ns succeeded rv if ns succeeded rv uses conversion rv profile service create new profile t2cw dialog m name nsnull nsnull pr false assert ns succeeded rv if ns succeeded rv int item m profilelist add string dialog m name m profilelist set cur sel item get dlg item idok enable window true cprofilesdlg onnewprofile cnewprofiledlg domodal nscomptr nsiprofile profileservice do_getservice ns_profile_contractid ns_succeeded ns_succeeded uses_conversion profileservice createnewprofile m_name pr_false ns_succeeded ns_succeeded m_profilelist addstring m_name m_profilelist setcursel getdlgitem enablewindow void c profiles dlg on rename profile c rename profile dlg dialog int item index m profilelist get cur sel assert item index lb err if item index lb err return m profilelist get text item index dialog m currentname if dialog do modal idok uses conversion nsresult rv nscom ptr nsi profile profile service do getservice ns profile contractid rv assert ns succeeded rv if ns succeeded rv rv profile service rename profile t2cw dialog m currentname t2w dialog m newname assert ns succeeded rv cprofilesdlg onrenameprofile crenameprofiledlg itemindex m_profilelist getcursel itemindex lb_err itemindex lb_err m_profilelist gettext itemindex m_currentname domodal uses_conversion nscomptr nsiprofile profileservice do_getservice ns_profile_contractid ns_succeeded ns_succeeded profileservice renameprofile m_currentname m_newname ns_succeeded void c profiles dlg on delete profile int item index m profilelist get cur sel assert item index lb err if item index lb err return c string selected profile m profilelist get text item index selected profile nsresult rv nscom ptr nsi profile profile service do getservice ns profile contractid rv assert ns succeeded rv if ns succeeded rv uses conversion rv profile service delete profile t2cw selected profile pr true assert ns succeeded rv if ns succeeded rv int item count m profilelist delete string item index if item count 0 get dlg item idok enable window false cprofilesdlg ondeleteprofile itemindex m_profilelist getcursel itemindex lb_err itemindex lb_err cstring selectedprofile m_profilelist gettext itemindex selectedprofile nscomptr nsiprofile profileservice do_getservice ns_profile_contractid ns_succeeded ns_succeeded uses_conversion profileservice deleteprofile selectedprofile pr_true ns_succeeded ns_succeeded itemcount m_profilelist deletestring itemindex itemcount getdlgitem enablewindow void c profiles dlg on dblclk profile onok cprofilesdlg ondblclkprofile c profile mgr c profile mgr cprofilemgr cprofilemgr c profile mgr c profile mgr cprofilemgr cprofilemgr m papersizeinx 0 afx data init c print setup dialog m bottommargin t m leftmargin t m rightmargin t m topmargin t m scaling 0 m printbgimages false m printbgcolors false m papersize t m paperheight 0 0 m paperwidth 0 0 m isinches 1 m footerleft t m footermiddle t m footerright t m headerleft t m headermiddle t m headerright t afx data init set print settings m printsettings m_papersizeinx afx_data_init cprintsetupdialog m_bottommargin _t m_leftmargin _t m_rightmargin _t m_topmargin _t m_scaling m_printbgimages m_printbgcolors m_papersize _t m_paperheight m_paperwidth m_isinches m_footerleft _t m_footermiddle _t m_footerright _t m_headerleft _t m_headermiddle _t m_headerright _t afx_data_init setprintsettings m_printsettings void c print setup dialog set print settings nsi print settings a print settings if a print settings null double top left right bottom a print settings get margin top top a print settings get margin left left a print settings get margin right right a print settings get margin bottom bottom char buf 16 sprintf buf 5 2f top m topmargin buf sprintf buf 5 2f left m leftmargin buf sprintf buf 5 2f right m rightmargin buf sprintf buf 5 2f bottom m bottommargin buf double scaling a print settings get scaling scaling m scaling int scaling 100 0 pr bool bool val a print settings get printbg colors bool val m printbgcolors bool val pr true a print settings get printbg images bool val m printbgimages bool val pr true pr unichar u str a print settings get header str left u str m headerleft u str if u str nsnull ns memory free u str a print settings get header str center u str m headermiddle u str if u str nsnull ns memory free u str a print settings get header str right u str m headerright u str if u str nsnull ns memory free u str a print settings get footer str left u str m footerleft u str if u str nsnull ns memory free u str a print settings get footer str center u str m footermiddle u str if u str nsnull ns memory free u str a print settings get footer str right u str m footerright u str if u str nsnull ns memory free u str cprintsetupdialog setprintsettings nsiprintsettings aprintsettings aprintsettings aprintsettings getmargintop aprintsettings getmarginleft aprintsettings getmarginright aprintsettings getmarginbottom m_topmargin m_leftmargin m_rightmargin m_bottommargin aprintsettings getscaling m_scaling prbool boolval aprintsettings getprintbgcolors boolval m_printbgcolors boolval pr_true aprintsettings getprintbgimages boolval m_printbgimages boolval pr_true prunichar ustr aprintsettings getheaderstrleft ustr m_headerleft ustr ustr nsmemory ustr aprintsettings getheaderstrcenter ustr m_headermiddle ustr ustr nsmemory ustr aprintsettings getheaderstrright ustr m_headerright ustr ustr nsmemory ustr aprintsettings getfooterstrleft ustr m_footerleft ustr ustr nsmemory ustr aprintsettings getfooterstrcenter ustr m_footermiddle ustr ustr nsmemory ustr aprintsettings getfooterstrright ustr m_footerright ustr ustr nsmemory ustr void c print setup dialog get paper size info short a unit double a width double a height if g paper size m papersizeinx m is user defined a unit m isinches 0 nsi print settings k paper size inches nsi print settings k paper size millimeters a width m paperwidth a height m paperheight else a unit g paper size m papersizeinx m unit a width g paper size m papersizeinx m width a height g paper size m papersizeinx m height cprintsetupdialog getpapersizeinfo aunit awidth aheight gpapersize m_papersizeinx misuserdefined aunit m_isinches nsiprintsettings kpapersizeinches nsiprintsettings kpapersizemillimeters awidth m_paperwidth aheight m_paperheight aunit gpapersize m_papersizeinx munit awidth gpapersize m_papersizeinx mwidth aheight gpapersize m_papersizeinx mheight void c print setup dialog do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c print setup dialog ddx text pdx idc bottom margin txt m bottommargin ddx text pdx idc left margin txt m leftmargin ddx text pdx idc right margin txt m rightmargin ddx text pdx idc top margin txt m topmargin ddx slider pdx idc scale m scaling ddx check pdx idc prt bgimages m printbgimages ddx check pdx idc prt bgcolors m printbgcolors ddx cbstring pdx idc paper size cbx m papersize ddx text pdx idc ud paper hgt m paperheight ddx text pdx idc ud paper wdth m paperwidth ddx radio pdx idc inches rd m isinches ddx text pdx idc ftr left txt m footerleft ddx text pdx idc ftr mid txt m footermiddle ddx text pdx idc ftr right txt m footerright ddx text pdx idc hdr left txt m headerleft ddx text pdx idc hdr mid txt m headermiddle ddx text pdx idc hdr right txt m headerright afx data map cprintsetupdialog dodataexchange cdataexchange cdialog dodataexchange afx_data_map cprintsetupdialog ddx_text idc_bottom_margin_txt m_bottommargin ddx_text idc_left_margin_txt m_leftmargin ddx_text idc_right_margin_txt m_rightmargin ddx_text idc_top_margin_txt m_topmargin ddx_slider idc_scale m_scaling ddx_check idc_prt_bgimages m_printbgimages ddx_check idc_prt_bgcolors m_printbgcolors ddx_cbstring idc_paper_size_cbx m_papersize ddx_text idc_ud_paper_hgt m_paperheight ddx_text idc_ud_paper_wdth m_paperwidth ddx_radio idc_inches_rd m_isinches ddx_text idc_ftr_left_txt m_footerleft ddx_text idc_ftr_mid_txt m_footermiddle ddx_text idc_ftr_right_txt m_footerright ddx_text idc_hdr_left_txt m_headerleft ddx_text idc_hdr_mid_txt m_headermiddle ddx_text idc_hdr_right_txt m_headerright afx_data_map void c print setup dialog enable user define controls bool a enable c wnd cntrl get dlg item idc ud width lbl cntrl enable window a enable cntrl get dlg item idc ud height lbl cntrl enable window a enable cntrl get dlg item idc ud paper wdth cntrl enable window a enable cntrl get dlg item idc ud paper hgt cntrl enable window a enable cntrl get dlg item idc inches rd cntrl enable window a enable cntrl get dlg item idc milli rd cntrl enable window a enable cprintsetupdialog enableuserdefinecontrols aenable cwnd getdlgitem idc_ud_width_lbl enablewindow aenable getdlgitem idc_ud_height_lbl enablewindow aenable getdlgitem idc_ud_paper_wdth enablewindow aenable getdlgitem idc_ud_paper_hgt enablewindow aenable getdlgitem idc_inches_rd enablewindow aenable getdlgitem idc_milli_rd enablewindow aenable int c print setup dialog get paper size index from data short a unit double aw double ah for int i 0 i g num paper sizes i if g paper size i m unit a unit g paper size i m width aw g paper size i m height ah return i find the first user defined for i 0 i g num paper sizes i if g paper size i m is user defined return i return 1 cprintsetupdialog getpapersizeindexfromdata aunit gnumpapersizes gpapersize munit aunit gpapersize mwidth gpapersize mheight gnumpapersizes gpapersize misuserdefined int c print setup dialog get paper size index const c string a str for int i 0 i g num paper sizes i if a str compare g paper size i m desc return i return 1 cprintsetupdialog getpapersizeindex cstring astr gnumpapersizes astr gpapersize mdesc void c print setup dialog onok c dialog onok cprintsetupdialog cdialog bool c print setup dialog on init dialog c dialog on init dialog c slider ctrl scale c slider ctrl get dlg item idc scale c wnd scale txt get dlg item idc scale txt if scale null scale set range 50 100 scale set buddy scale txt false scale set tic freq 10 c combo box cbx c combo box get dlg item idc paper size cbx if cbx null first initialize the combobox for int i 0 i g num paper sizes i cbx add string g paper size i m desc short unit double paper width 0 0 double paper height 0 0 m printsettings get paper size type unit m printsettings get paper width paper width m printsettings get paper height paper height m papersizeinx get paper size index from data unit paper width paper height if m papersizeinx 1 couldn t find a match m papersizeinx 0 unit g paper size m papersizeinx m unit paper width g paper size m papersizeinx m width paper height g paper size m papersizeinx m height cbx set cur sel m papersizeinx enable user define controls g paper size m papersizeinx m is user defined if g paper size m papersizeinx m is user defined c string w str c string h str if unit nsi print settings k paper size inches w str format 6 2f paper width h str format 6 2f paper height check radio button idc inches rd idc milli rd idc inches rd else w str format d int paper width h str format d int paper height check radio button idc inches rd idc milli rd idc milli rd c wnd width txt get dlg item idc ud paper wdth c wnd height txt get dlg item idc ud paper hgt width txt set window text w str height txt set window text h str else check radio button idc inches rd idc milli rd idc inches rd return true return true unless you set the focus to a control exception ocx property pages should return false cprintsetupdialog oninitdialog cdialog oninitdialog csliderctrl csliderctrl getdlgitem idc_scale cwnd scaletxt getdlgitem idc_scale_txt setrange setbuddy scaletxt setticfreq ccombobox ccombobox getdlgitem idc_paper_size_cbx gnumpapersizes addstring gpapersize mdesc paperwidth paperheight m_printsettings getpapersizetype m_printsettings getpaperwidth paperwidth m_printsettings getpaperheight paperheight m_papersizeinx getpapersizeindexfromdata paperwidth paperheight m_papersizeinx m_papersizeinx gpapersize m_papersizeinx munit paperwidth gpapersize m_papersizeinx mwidth paperheight gpapersize m_papersizeinx mheight setcursel m_papersizeinx enableuserdefinecontrols gpapersize m_papersizeinx misuserdefined gpapersize m_papersizeinx misuserdefined cstring wstr cstring hstr nsiprintsettings kpapersizeinches wstr paperwidth hstr paperheight checkradiobutton idc_inches_rd idc_milli_rd idc_inches_rd wstr paperwidth hstr paperheight checkradiobutton idc_inches_rd idc_milli_rd idc_milli_rd cwnd widthtxt getdlgitem idc_ud_paper_wdth cwnd heighttxt getdlgitem idc_ud_paper_hgt widthtxt setwindowtext wstr heighttxt setwindowtext hstr checkradiobutton idc_inches_rd idc_milli_rd idc_inches_rd void c print setup dialog on customdraw scale nmhdr pnmhdr lresult p result c slider ctrl scale c slider ctrl get dlg item idc scale c wnd scale txt get dlg item idc scale txt if scale null scale txt null c string str str format d scale get pos scale txt set window text str p result 0 cprintsetupdialog oncustomdrawscale presult csliderctrl csliderctrl getdlgitem idc_scale cwnd scaletxt getdlgitem idc_scale_txt scaletxt cstring getpos scaletxt setwindowtext presult void c print setup dialog on killfocus scale txt c slider ctrl scale c slider ctrl get dlg item idc scale c wnd scale txt get dlg item idc scale txt if scale null scale txt null c string str scale txt get window text str scale set pos get int from str str cprintsetupdialog onkillfocusscaletxt csliderctrl csliderctrl getdlgitem idc_scale cwnd scaletxt getdlgitem idc_scale_txt scaletxt cstring scaletxt getwindowtext setpos getintfromstr void c print setup dialog on selchange paper size cbx c combo box cbx c combo box get dlg item idc paper size cbx if cbx c string text cbx get window text text m papersizeinx get paper size index text enable user define controls g paper size m papersizeinx m is user defined cprintsetupdialog onselchangepapersizecbx ccombobox ccombobox getdlgitem idc_paper_size_cbx cstring getwindowtext m_papersizeinx getpapersizeindex enableuserdefinecontrols gpapersize m_papersizeinx misuserdefined int c print progress dialog do modal pr bool do modal pr false nscom ptr nsi web browser print print do getinterface m webbrowser if print m printlistener new c dlg print listener this constructor addrefs if m printlistener do modal will be set to false if the print job was cancelled nsi web progress listener wpl ns static cast nsi web progress listener m printlistener do modal ns succeeded print print m printsettings wpl pr true if do modal m inmodalmode pr true return c dialog do modal return 0 cprintprogressdialog domodal prbool domodal pr_false nscomptr nsiwebbrowserprint do_getinterface m_webbrowser m_printlistener cdlgprintlistener m_printlistener domodal nsiwebprogresslistener ns_static_cast nsiwebprogresslistener m_printlistener domodal ns_succeeded m_printsettings pr_true domodal m_inmodalmode pr_true cdialog domodal void c print progress dialog seturi const char a title m url t a title cprintprogressdialog atitle m_url _t atitle void c print progress dialog do data exchange c data exchange pdx c dialog do data exchange pdx afx data map c print progress dialog note the class wizard will add ddx and ddv calls here afx data map cprintprogressdialog dodataexchange cdataexchange cdialog dodataexchange afx_data_map cprintprogressdialog classwizard afx_data_map bool c print progress dialog on init dialog c dialog on init dialog c rect client rect get client rect client rect c rect title rect get local rect get dlg item idc ppd doc title static title rect this c rect item rect get local rect get dlg item idc ppd doc txt item rect this c rect prog rect prog rect left title rect left prog rect top item rect top item rect height 5 prog rect right client rect width 2 title rect left prog rect bottom prog rect top title rect height m wndprogress create ws child ws visible prog rect this 1 m wndprogress set pos 0 return true return true unless you set the focus to a control exception ocx property pages should return false cprintprogressdialog oninitdialog cdialog oninitdialog crect clientrect getclientrect clientrect crect titlerect getlocalrect getdlgitem idc_ppd_doc_title_static titlerect crect itemrect getlocalrect getdlgitem idc_ppd_doc_txt itemrect crect progrect progrect titlerect progrect itemrect itemrect progrect clientrect titlerect progrect progrect titlerect m_wndprogress ws_child ws_visible progrect m_wndprogress setpos void c print progress dialog on cancel nscom ptr nsi web browser print print do getinterface m webbrowser if print print cancel c dialog on cancel cprintprogressdialog oncancel nscomptr nsiwebbrowserprint do_getinterface m_webbrowser cdialog oncancel inline c bookmark node id 0 order 0 text url nick desc type 0 flags 0 next null child null last child null in panel panel pos bar pos add date 0 last visit 0 last modified 0 cbookmarknode lastchild in_panel panel_pos bar_pos adddate lastvisit lastmodified inline c bookmark node int id const char text const char url const char nick const char desc int type time t add date 0 time t last visit 0 time t last modified 0 long order 1 const char in panel null const char panel pos null const char bar pos null this id id this order order this text text this url url this nick nick this desc desc this type type this flags 0 this in panel in panel in panel this panel pos panel pos panel pos this bar pos bar pos bar pos this next null this child null this last child null this add date add date this last visit last visit this last modified last modified cbookmarknode time_t adddate time_t lastvisit time_t lastmodified in_panel panel_pos bar_pos in_panel in_panel in_panel panel_pos panel_pos panel_pos bar_pos bar_pos bar_pos lastchild adddate adddate lastvisit lastvisit lastmodified lastmodified inline c bookmark node int id std string text std string url std string nick std string desc int type time t add date 0 time t last visit 0 time t last modified 0 long order 1 const char in panel null const char panel pos null const char bar pos null this id id this order order this text text this url url this nick nick this desc desc this type type this flags 0 this in panel in panel in panel this panel pos panel pos panel pos this bar pos bar pos bar pos this next null this child null this last child null this add date add date this last visit last visit this last modified last modified cbookmarknode time_t adddate time_t lastvisit time_t lastmodified in_panel panel_pos bar_pos in_panel in_panel in_panel panel_pos panel_pos panel_pos bar_pos bar_pos bar_pos lastchild adddate adddate lastvisit lastvisit lastmodified lastmodified inline c bookmark node when we delete next it s destructor will delete it s next which will delete it s next etc if next delete next same with child if child delete child cbookmarknode inline c bookmark node operator c bookmark node n2 id n2 id order n2 order text n2 text url n2 url nick n2 nick desc n2 desc type n2 type flags n2 flags in panel n2 in panel panel pos n2 panel pos bar pos n2 bar pos add date n2 add date last visit n2 last visit last modified n2 last modified if child delete child if next delete next if n2 child child new c bookmark node child n2 child need to rebuild pointer to last child can t just grab it from n2 last child child while last child next last child last child next else child null if n2 next next new c bookmark node next n2 next else next null return this cbookmarknode cbookmarknode in_panel in_panel panel_pos panel_pos bar_pos bar_pos adddate adddate lastvisit lastvisit lastmodified lastmodified cbookmarknode lastchild lastchild lastchild lastchild lastchild cbookmarknode inline void add child c bookmark node new child if child last child next new child else child new child last child new child addchild cbookmarknode newchild lastchild newchild newchild lastchild newchild bool unlink node c bookmark node node c bookmark node c c bookmark node previous null for c child c previous c c c next if c node found our node to delete first redirect traffic around it if previous previous next node next else child node next if we are the last item set our parent s last child to the item before us if node next last child previous we have to set our next to null if we don t do this when we are deleted we will try to delete our next which would result in pretty much the whole menu being deleted node next null return true return false unlinknode cbookmarknode cbookmarknode cbookmarknode lastchild lastchild bool delete node c bookmark node node if unlink node node delete node return true return false deletenode cbookmarknode unlinknode c bookmark node find node int id c bookmark node c for c child c c c next if c type bookmark separator continue else if c type bookmark folder fixme they currently could be stored out of order after being shuffled around in the edit dialog so we can t use this optimization perhaps re id bookmarks after edit it might be worth it if speed becomes an issue this little bit of code is for optimizations it assumes the items are stored in order if the items ever get out of order we need to remove this code c bookmark node lc c last child if lc lc type bookmark bookmark lc id id continue c bookmark node ret node c find node id if ret node found it in a sub node return ret node else if c id id this is it return c we couldn t find it rather than returning null and risking a null pointer crash return ourself return this scratch that we return null and just fix anything that crashes return null cbookmarknode findnode cbookmarknode bookmark_separator bookmark_folder cbookmarknode lastchild bookmark_bookmark cbookmarknode retnode findnode retnode retnode c bookmark node find nick char nick c bookmark node c for c child c c c next if c type bookmark separator continue else if c type bookmark folder if strcmp char c nick c str nick 0 this is it return c c bookmark node ret node c find nick nick if ret node found it in a sub node return ret node else if strcmp char c nick c str nick 0 this is it return c return null cbookmarknode findnick cbookmarknode bookmark_separator bookmark_folder c_str cbookmarknode retnode findnick retnode retnode c_str c bookmark node find special node int flag c bookmark node c for c child c c c next if c flags flag this is it return c else if c type bookmark folder c bookmark node ret node c find special node flag if ret node c found it in a sub node return ret node we couldn t find it rather than returning null and risking a null pointer crash return ourself return this cbookmarknode findspecialnode cbookmarknode bookmark_folder cbookmarknode retnode findspecialnode retnode retnode int index int mypos c bookmark node node c bookmark node c for c child c c c next mypos if c type bookmark separator continue else if node c return mypos if c type bookmark folder int newpos c index mypos node if newpos 0 return newpos return 1 cbookmarknode cbookmarknode bookmark_separator bookmark_folder int search const char str int pos int mypos int firstpos c bookmark node node c bookmark node c for c child c c c next mypos if c type bookmark separator continue else if stristr c text c str str stristr c url c str str stristr c nick c str str stristr c desc c str str if mypos pos this is it if node node c return mypos else if firstpos 1 firstpos mypos if c type bookmark folder int newpos c search str pos mypos firstpos node if newpos pos found it in a sub node return newpos return firstpos cbookmarknode cbookmarknode bookmark_separator c_str c_str c_str c_str bookmark_folder void sort int sortorder if child return c bookmark node c int i 0 for c child c c c next i if i 0 return void buf void calloc i sizeof void if buf return for i 0 c child c c c next i buf i void c quicksort char buf i sizeof void compare bookmarks sortorder child c bookmark node buf 0 for int j 0 j i 1 j c c bookmark node buf j c next c bookmark node buf j 1 c c bookmark node buf i 1 c next null last child c free buf for c child c c c next if c type bookmark folder c sort sortorder cbookmarknode comparebookmarks cbookmarknode cbookmarknode cbookmarknode cbookmarknode lastchild bookmark_folder inline c bookmark node id 0 text url nick desc charset type 0 flags 0 next null child null last child null add date 0 last visit 0 last modified 0 cbookmarknode lastchild adddate lastvisit lastmodified inline c bookmark node int id const char text const char url const char nick const char desc const char charset int type time t add date 0 time t last visit 0 time t last modified 0 this id id this text text this url url this nick nick nick this desc desc desc this charset charset charset this type type this flags 0 this next null this child null this last child null this add date add date this last visit last visit this last modified last modified cbookmarknode time_t adddate time_t lastvisit time_t lastmodified lastchild adddate adddate lastvisit lastvisit lastmodified lastmodified inline c bookmark node int id std string text std string url std string nick std string desc std string charset int type time t add date 0 time t last visit 0 time t last modified 0 this id id this text text this url url this nick nick this desc desc this charset charset this type type this flags 0 this next null this child null this last child null this add date add date this last visit last visit this last modified last modified cbookmarknode time_t adddate time_t lastvisit time_t lastmodified lastchild adddate adddate lastvisit lastvisit lastmodified lastmodified inline c bookmark node when we delete next it s destructor will delete it s next which will delete it s next etc if next delete next same with child if child delete child cbookmarknode inline c bookmark node operator c bookmark node n2 id n2 id text n2 text url n2 url nick n2 nick desc n2 desc charset n2 charset type n2 type flags n2 flags add date n2 add date last visit n2 last visit last modified n2 last modified if child delete child if next delete next if n2 child child new c bookmark node child n2 child need to rebuild pointer to last child can t just grab it from n2 last child child while last child next last child last child next else child null if n2 next next new c bookmark node next n2 next else next null return this cbookmarknode cbookmarknode adddate adddate lastvisit lastvisit lastmodified lastmodified cbookmarknode lastchild lastchild lastchild lastchild lastchild cbookmarknode inline void add child c bookmark node new child if child last child next new child else child new child last child new child addchild cbookmarknode newchild lastchild newchild newchild lastchild newchild bool unlink node c bookmark node node c bookmark node c c bookmark node previous null for c child c previous c c c next if c node found our node to delete first redirect traffic around it if previous previous next node next else child node next if we are the last item set our parent s last child to the item before us if node next last child previous we have to set our next to null if we don t do this when we are deleted we will try to delete our next which would result in pretty much the whole menu being deleted node next null return true return false unlinknode cbookmarknode cbookmarknode cbookmarknode lastchild lastchild bool delete node c bookmark node node if unlink node node delete node return true return false deletenode cbookmarknode unlinknode c bookmark node find node int id c bookmark node c for c child c c c next if c type bookmark separator continue else if c type bookmark folder fixme they currently could be stored out of order after being shuffled around in the edit dialog so we can t use this optimization perhaps re id bookmarks after edit it might be worth it if speed becomes an issue this little bit of code is for optimizations it assumes the items are stored in order if the items ever get out of order we need to remove this code c bookmark node lc c last child if lc lc type bookmark bookmark lc id id continue c bookmark node ret node c find node id if ret node found it in a sub node return ret node else if c id id this is it return c we couldn t find it rather than returning null and risking a null pointer crash return ourself return this scratch that we return null and just fix anything that crashes return null cbookmarknode findnode cbookmarknode bookmark_separator bookmark_folder cbookmarknode lastchild bookmark_bookmark cbookmarknode retnode findnode retnode retnode c bookmark node find nick char nick c bookmark node c for c child c c c next if c type bookmark separator continue else if c type bookmark folder if strcmp char c nick c str nick 0 this is it return c c bookmark node ret node c find nick nick if ret node found it in a sub node return ret node else if strcmp char c nick c str nick 0 this is it return c return null cbookmarknode findnick cbookmarknode bookmark_separator bookmark_folder c_str cbookmarknode retnode findnick retnode retnode c_str c bookmark node find special node int flag c bookmark node c for c child c c c next if c flags flag this is it return c else if c type bookmark folder c bookmark node ret node c find special node flag if ret node c found it in a sub node return ret node we couldn t find it rather than returning null and risking a null pointer crash return ourself return this cbookmarknode findspecialnode cbookmarknode bookmark_folder cbookmarknode retnode findspecialnode retnode retnode int index int mypos c bookmark node node c bookmark node c for c child c c c next mypos if c type bookmark separator continue else if node c return mypos if c type bookmark folder int newpos c index mypos node if newpos 0 return newpos return 1 cbookmarknode cbookmarknode bookmark_separator bookmark_folder int search const char str int pos int mypos int firstpos c bookmark node node c bookmark node c for c child c c c next mypos if c type bookmark separator continue else if stristr c text c str str stristr c url c str str stristr c nick c str str stristr c desc c str str if mypos pos this is it if node node c return mypos else if firstpos 1 firstpos mypos if c type bookmark folder int newpos c search str pos mypos firstpos node if newpos pos found it in a sub node return newpos return firstpos cbookmarknode cbookmarknode bookmark_separator c_str c_str c_str c_str bookmark_folder void sort int sortorder if child return c bookmark node c int i 0 for c child c c c next i if i 0 return void buf void calloc i sizeof void if buf return for i 0 c child c c c next i buf i void c quicksort char buf i sizeof void compare bookmarks sortorder child c bookmark node buf 0 for int j 0 j i 1 j c c bookmark node buf j c next c bookmark node buf j 1 c c bookmark node buf i 1 c next null last child c free buf for c child c c c next if c type bookmark folder sortorder 1 c sort sortorder cbookmarknode comparebookmarks cbookmarknode cbookmarknode cbookmarknode cbookmarknode lastchild bookmark_folder inline c bookmark node id 0 order 0 text path url type 0 flags 0 next null child null last child null add date 0 last visit 0 last modified 0 cbookmarknode lastchild adddate lastvisit lastmodified inline c bookmark node int id const char text const char path int type time t add date 0 time t last visit 0 time t last modified 0 long order long max this id id this order order this text text this path path this url this type type this flags 0 this next null this child null this last child null this add date add date this last visit last visit this last modified last modified cbookmarknode time_t adddate time_t lastvisit time_t lastmodified long_max lastchild adddate adddate lastvisit lastvisit lastmodified lastmodified inline c bookmark node int id std string text std string path int type time t add date 0 time t last visit 0 time t last modified 0 long order long max this id id this order order this text text this path path this url this type type this flags 0 this next null this child null this last child null this add date add date this last visit last visit this last modified last modified cbookmarknode time_t adddate time_t lastvisit time_t lastmodified long_max lastchild adddate adddate lastvisit lastvisit lastmodified lastmodified inline c bookmark node when we delete next it s destructor will delete it s next which will delete it s next etc if next delete next same with child if child delete child cbookmarknode inline c bookmark node operator c bookmark node n2 id n2 id order n2 order text n2 text path n2 path url n2 url type n2 type flags n2 flags add date n2 add date last visit n2 last visit last modified n2 last modified if child delete child if next delete next if n2 child child new c bookmark node child n2 child need to rebuild pointer to last child can t just grab it from n2 last child child while last child next last child last child next else child null if n2 next next new c bookmark node next n2 next else next null return this cbookmarknode cbookmarknode adddate adddate lastvisit lastvisit lastmodified lastmodified cbookmarknode lastchild lastchild lastchild lastchild lastchild cbookmarknode inline void add child c bookmark node new child if child last child next new child else child new child last child new child addchild cbookmarknode newchild lastchild newchild newchild lastchild newchild bool unlink node c bookmark node node c bookmark node c c bookmark node previous null for c child c previous c c c next if c node found our node to delete first redirect traffic around it if previous previous next node next else child node next if we are the last item set our parent s last child to the item before us if node next last child previous we have to set our next to null if we don t do this when we are deleted we will try to delete our next which would result in pretty much the whole menu being deleted node next null return true return false unlinknode cbookmarknode cbookmarknode cbookmarknode lastchild lastchild bool delete node c bookmark node node if unlink node node delete node return true return false deletenode cbookmarknode unlinknode c bookmark node find node int id c bookmark node c for c child c c c next if c type bookmark separator continue else if c type bookmark folder fixme they currently could be stored out of order after being shuffled around in the edit dialog so we can t use this optimization perhaps re id bookmarks after edit it might be worth it if speed becomes an issue this little bit of code is for optimizations it assumes the items are stored in order if the items ever get out of order we need to remove this code c bookmark node lc c last child if lc lc type bookmark bookmark lc id id continue c bookmark node ret node c find node id if ret node found it in a sub node return ret node else if c id id this is it return c we couldn t find it rather than returning null and risking a null pointer crash return ourself return this scratch that we return null and just fix anything that crashes return null cbookmarknode findnode cbookmarknode bookmark_separator bookmark_folder cbookmarknode lastchild bookmark_bookmark cbookmarknode retnode findnode retnode retnode c bookmark node find special node int flag c bookmark node c for c child c c c next if c flags flag this is it return c else if c type bookmark folder c bookmark node ret node c find special node flag if ret node c found it in a sub node return ret node we couldn t find it rather than returning null and risking a null pointer crash return ourself return this cbookmarknode findspecialnode cbookmarknode bookmark_folder cbookmarknode retnode findspecialnode retnode retnode void sort int sortorder if child return c bookmark node c int i 0 for c child c c c next i if i 0 return void buf void calloc i sizeof void if buf return for i 0 c child c c c next i buf i void c quicksort char buf i sizeof void compare bookmarks sortorder child c bookmark node buf 0 for int j 0 j i 1 j c c bookmark node buf j c next c bookmark node buf j 1 c c bookmark node buf i 1 c next null last child c free buf for c child c c c next if c type bookmark folder c sort sortorder cbookmarknode comparebookmarks cbookmarknode cbookmarknode cbookmarknode cbookmarknode lastchild bookmark_folder class node next node char macro char arg this macro macro this arg arg id k funcs get commandi ds 1 next null kfuncs getcommandids public arg list root null arglist int add char macro char arg class node ptr root while ptr strcmp ptr macro c str macro strcmp ptr arg c str arg ptr ptr next if ptr return ptr id ptr new node macro arg if root null min max ptr id if max ptr id max ptr id ptr next root root ptr return ptr id c_str c_str bool execute hwnd h wnd int id if id min id max return false class node ptr root while ptr ptr id id ptr ptr next if ptr ptr id id int cmdid find macro char ptr macro c str if cmdid notfound s global arg ptr arg execute macro h wnd cmdid s global arg return true return false hwnd findmacro c_str sglobalarg executemacro hwnd sglobalarg void reset tokenizer char data str data data pos lpos 0 instr false if str data length 0 if str data at 0 instr true lastchar str data at 0 else lastchar 0 resettokenizer strdata strdata strdata strdata int next token std string out if pos str data length return 0 while pos str data length 1 if str data at pos lastchar lastchar 0 continue if str data at pos lastchar instr instr false true lastchar continue if instr if str data at pos if out out str val str data substr lpos pos lpos 1 lpos pos 1 lastchar return 1 lastchar str data at pos if out out str val str data substr lpos 1 return 1 nexttoken strdata strdata strdata strdata strdata strval strdata strdata strval strdata inline c history node url type 0 next null child null last child null last visit 0 chistorynode lastchild lastvisit inline c history node const char url int type time t last visit 0 this url url this type type this next null this child null this last child null this last visit last visit chistorynode time_t lastvisit lastchild lastvisit lastvisit inline c history node std string url int type time t last visit 0 this url url this type type this next null this child null this last child null this last visit last visit chistorynode time_t lastvisit lastchild lastvisit lastvisit inline c history node when we delete next it s destructor will delete it s next which will delete it s next etc if next delete next same with child if child delete child chistorynode inline c history node operator c history node n2 url n2 url type n2 type last visit n2 last visit if child delete child if next delete next if n2 child child new c history node child n2 child need to rebuild pointer to last child can t just grab it from n2 last child child while last child next last child last child next else child null if n2 next next new c history node next n2 next else next null return this chistorynode chistorynode lastvisit lastvisit chistorynode lastchild lastchild lastchild lastchild lastchild chistorynode inline void add child c history node new child if child last child next new child else child new child last child new child addchild chistorynode newchild lastchild newchild newchild lastchild newchild bool unlink node c history node node c history node c c history node previous null for c child c previous c c c next if c node found our node to delete first redirect traffic around it if previous previous next node next else child node next if we are the last item set our parent s last child to the item before us if node next last child previous we have to set our next to null if we don t do this when we are deleted we will try to delete our next which would result in pretty much the whole menu being deleted node next null return true return false unlinknode chistorynode chistorynode chistorynode lastchild lastchild bool delete node c history node node if unlink node node delete node return true return false deletenode chistorynode unlinknode int index int mypos c history node node c history node c for c child c c c next mypos if c type history separator continue else if node c return mypos if c type history folder int newpos c index mypos node if newpos 0 return newpos return 1 chistorynode chistorynode history_separator history_folder int search const char str int pos int mypos int firstpos c history node node c history node c for c child c c c next mypos if c type history separator continue else if stristr c url c str str if mypos pos this is it if node node c return mypos else if firstpos 1 firstpos mypos if c type history folder int newpos c search str pos mypos firstpos node if newpos pos found it in a sub node return newpos return firstpos chistorynode chistorynode history_separator c_str history_folder void flatten c history node c prev null for c child c c c next if c type history folder c child null c history node old c c history node tmp c next c flatten c c child if prev prev next c else child c while c next c c next c next tmp old next null old child null delete old prev c last child prev chistorynode history_folder chistorynode chistorynode lastchild int size int i 1 if type history folder child i i child size if next i i next size return i history_folder void sort int sortorder if child return c history node c int i 0 for c child c c c next i if i 0 return void buf void calloc i sizeof void if buf return for i 0 c child c c c next i buf i void c quicksort char buf i sizeof void compare bookmarks sortorder child c history node buf 0 for int j 0 j i 1 j c c history node buf j c next c history node buf j 1 c c history node buf i 1 c next null last child c free buf for c child c c c next if c type history folder c sort sortorder chistorynode comparebookmarks chistorynode chistorynode chistorynode chistorynode lastchild history_folder