You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(102) |
Dec
(255) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(38) |
Feb
(16) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ma...@us...> - 2003-12-19 03:01:17
|
Update of /cvsroot/sharedaemon/ui-wx/src/images/default In directory sc8-pr-cvs1:/tmp/cvs-serv11041/src/images/default Added Files: mule.xpm Log Message: Hetfields systray (Patch #845694) --- NEW FILE: mule.xpm --- /* XPM */ static char * mule_xpm[] = { "16 16 117 2", " c None", ". c #642909", "+ c #D38B4B", "@ c #DCA36C", "# c #D18849", "$ c #CE8240", "% c #AE6227", "& c #C77631", "* c #B7692A", "= c #EBC999", "- c #E4B886", "; c #D38E52", "> c #9A5522", ", c #77380F", "' c #E1AF7C", ") c #D7995A", "! c #86461A", "~ c #8E4A1A", "{ c #D48D4E", "] c #AE6327", "^ c #954F1D", "/ c #B86B2C", "( c #793910", "_ c #9B5724", ": c #A65D24", "< c #C67530", "[ c #5D2D0E", "} c #DEAA7D", "| c #EDCFB5", "1 c #B56F36", "2 c #C0712F", "3 c #D89F6E", "4 c #FFFFFF", "5 c #DCD6D1", "6 c #000000", "7 c #8E4D1E", "8 c #45312A", "9 c #32373E", "0 c #70320E", "a c #CF874A", "b c #F6E7DA", "c c #9C9691", "d c #414041", "e c #A7602A", "f c #D4B595", "g c #E5DCD2", "h c #F2F2F1", "i c #BDBDB6", "j c #954E1D", "k c #DCA25C", "l c #D79453", "m c #CA7B38", "n c #D49259", "o c #C27739", "p c #C68338", "q c #CDAE80", "r c #6B6C6F", "s c #171614", "t c #B3B3B0", "u c #AB6026", "v c #D48E4F", "w c #EFD5A7", "x c #E1B17E", "y c #B4682C", "z c #AD6228", "A c #BE7D3F", "B c #B6B6B0", "C c #AAAAA7", "D c #A0A09F", "E c #E3E3E0", "F c #CD813F", "G c #D99A61", "H c #DBA06B", "I c #BD6F2E", "J c #B67139", "K c #D4CDC2", "L c #E9E9E6", "M c #F7F7F6", "N c #F9F9F9", "O c #EEEEEC", "P c #6E310C", "Q c #B5682A", "R c #D89C47", "S c #C77731", "T c #BA6C2C", "U c #A15821", "V c #B68B67", "W c #C9C2B9", "X c #DCDCDA", "Y c #E9E9E7", "Z c #EFEFEE", "` c #E7E7E5", " . c #A55C25", ".. c #A65D25", "+. c #9C5420", "@. c #7C4D2D", "#. c #A0A09E", "$. c #CACAC6", "%. c #64676B", "&. c #CCCCC7", "*. c #DFDFDB", "=. c #878889", "-. c #97511E", ";. c #833F14", ">. c #682B09", ",. c #652909", "'. c #572D16", "). c #3F3330", "!. c #6D7072", "~. c #979797", "{. c #B3B3B2", "]. c #4E5257", "^. c #914C1B", "/. c #C37A31", "(. c #E49C3F", "_. c #D48C38", ":. c #AC6328", " . . . . . . . . . . ", " . + . . . @ # $ $ % . ", " . & * . . = - ; $ > . . ", " . * , $ ' ) # ! . . ", ". . ~ $ { $ ] . ", " . ^ / ] ] ( _ . ", ". . : / < [ } | 1 . ", " . / 2 < 3 4 5 6 7 . 8 9 9 ", ". 0 & $ & a b c d e f g h i 9 ", ". j { k l m a n o p q r s h t 9 ", ". u v w x { m y z A B C D h E 9 ", ". ^ F G H { m I z J K L M N O 9 ", ". P Q F F R S T U V W X Y Z ` 9 ", ". ( . . ... .+.@.#.$.%.&.*.=.9 ", "P ~ -.;.>.,.'.).9 !.~.{.].9 9 ", "P ^./.(._.:.,. 9 9 9 9 "}; |
From: <ma...@us...> - 2003-12-19 03:01:17
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv11041 Modified Files: Changelog configure Log Message: Hetfields systray (Patch #845694) Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.106 retrieving revision 1.107 diff -u -d -r1.106 -r1.107 --- Changelog 17 Dec 2003 09:47:35 -0000 1.106 +++ Changelog 19 Dec 2003 03:01:12 -0000 1.107 @@ -21,13 +21,17 @@ # ALL ChangeLog entries end with a dot. # ############################################################################### +2003/19/12 Alo Sarv + * Imported Hetfield's GTK systray. + +2003/18/12 Alo Sarv + * Dialog pages can now be detached from main frame and displayed as + separate frame. Not supported on wxMac. + 2003/17/12 Alo Sarv * Serverpage look enhancements - * Toolbar right-click popup menu (right-click on empty space in tbar) + * Toolbar right-click popup menu (right-click on empty space in tbar). * Fullscreen mode switch - * Initial support for detaching dialog pages and displaying them as - separate frame (disabled by default due to its experimental - nature). 2003/13/12 Alo Sarv * Configure script Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- configure 17 Dec 2003 03:56:19 -0000 1.5 +++ configure 19 Dec 2003 03:01:14 -0000 1.6 @@ -1,3 +1,4 @@ +#!/bin/sh ################################################################################ # This file is part of wxInterface. # # Copyright (C) 2003 Alo Sarv <ma...@us...> # @@ -17,8 +18,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ################################################################################ -#!/bin/sh - ## # Checks for ccache (compiler cache) availability # @@ -63,7 +62,14 @@ wxconfig=/wx/dynamic/2.5.0/bin/wx-config; else echo "${colour_no}no${colour_default}"; - not_found; + cat <<EOF +wx-config was not found in standard locations. This means that either you do not +have wxWindows library installed for your platform (wxGTK for Linux, wxMac for +Mac OS, wxMSW for MS Windows), you are missing wxWindows developer package or +you have installed wxWindows into non-standard location. In the latter case, +rerun configure with --with-wx-config=/path/to/wx-config. +EOF + exit 1; fi; echo -e "${colour_yes}yes${colour_default}"; } @@ -125,20 +131,6 @@ } ## -# Outputs error message about wx-config not being found, and prints suggestions. -# -function not_found() { - cat <<EOF -wx-config was not found in standard locations. This means that either you do not -have wxWindows library installed for your platform (wxGTK for Linux, wxMac for -Mac OS, wxMSW for MS Windows), you are missing wxWindows developer package or -you have installed wxWindows into non-standard location. In the latter case, -rerun configure with --with-wx-config=/path/to/wx-config. -EOF - exit 1; -} - -## # Outputs error message about too old wxWindows library and exits with false. # function wrong_version() { @@ -155,11 +147,6 @@ # Generates Makefile from Makefile.am # gen_makefile() { - if test $show_flags = 1; then - print_cpp_flags=" with flags: `$wxconfig --cxxflags` $cppflags $include"; - print_link_flags=" with flags: `$wxconfig --libs`"; - fi; - echo "creating Makefile"; cp -f Makefile.am Makefile; echo "creating src/Makefile"; @@ -182,14 +169,31 @@ cppflags="$cppflags -D__HAVE_REMOVE_GROWABLE_COL__" fi; + linkflags=`$wxconfig --libs`; + + if test $has_gtk = 1; then + cppflags="$cppflags -D__HAS_GTK_CONFIG__"; + tray_objs="TrayCoreEngine.o"; + cflags="`$gtkconfig --cflags`"; + cppflags="$cppflags `$gtkconfig --cflags`"; + linkflags="$linkflags `$gtkconfig --libs`"; + fi; + + if test $show_flags = 1; then + print_cpp_flags=" with flags: `$wxconfig --cxxflags` $cppflags $include"; + print_link_flags=" with flags: $linkflags"; + fi; + sed -e "\ s#@CXX@#$ccache `$wxconfig --cxx`#; \ s#@CXX_FLAGS@#`$wxconfig --cxxflags`#; \ - s#@LIBS@#`$wxconfig --libs`#; \ - s#@CPP_FLAGS@#$cppflags#; \ + s#@CFLAGS@#$cflags#; \ + s#@LIBS@#$linkflags#; \ + s#@CPP_FLAGS@#$cppflags#; \ s#@INCLUDE@#$include#; \ - s#@PRINT_CPP_FLAGS@#$print_cpp_flags#;\ - s#@PRINT_LINK_FLAGS@#$print_link_flags#;\ + s#@PRINT_CPP_FLAGS@#$print_cpp_flags#; \ + s#@PRINT_LINK_FLAGS@#$print_link_flags#; \ + s#@TRAY_OBJECTS@#$tray_objs#; \ " src/Makefile.am >> src/Makefile; } @@ -199,6 +203,7 @@ parse_cmdline() { # defaults wxconfig=wx-config; + gtkconfig=gtk-config; prefix=/usr/local/bin; include=-I/local/include; include_dir=/local/include; @@ -222,6 +227,9 @@ --with-wx-config=*) wxconfig=$optarg; ;; + --with-gtk-config=*) + gtkconfig=$optarg; + ;; --prefix=*) prefix=$optarg; ;; @@ -296,7 +304,7 @@ echo -e -n "checking for --enable-debug\t\t\t"; if test $debug = 1; then echo -e "${colour_yes}yes${colour_default}"; - cppflags="$cppflags -g -ggdb -fno-inline" + cppflags="$cppflags -g -ggdb -fno-inline -Wall" else echo -e "${colour_no}no${colour_default}"; fi; @@ -332,6 +340,7 @@ Usage: --help Print this message and return to shell --with-wx-config=DIR Specify the location of wx-config script + --with-gtk-config=DIR Specify the location of gtk-config --enable-optimise Optimize code ( recommended for users) --enable-debug Enable debugging ( recommended for devs) --enable-profile Enable profiling ( recommended for devs) @@ -345,6 +354,45 @@ exit 0; } +### +# Checks for availability of GTK headers (needed for GTK systray) +# +function check_gtkconfig() { +if $wxconfig --cppflags | grep -q 'gtk'; then + echo -e -n "checking for gtk-config..."; + if test -x $gtkconfig; then + gtkconfig=$gtkconfig; + has_gtk=1; + elif test -x /usr/local/bin/gtk-config; then + gtkconfig=/usr/local/bin/gtk-config; + has_gtk=1; + elif test -x /usr/bin/gtk-config; then + gtkconfig=/usr/bin/gtk-config; + has_gtk=1; + elif test -x /bin/gtk-config; then + gtkconfig=/bin/gtk-config; + has_gtk=1; + elif test -x /local/bin/gtk-config; then + gtkconfig=/local/bin/gtk-config; + has_gtk=1; + else + echo -e "${colour_no}no${colour_warning}"; + cat << EOF +gtk-config was not found in standard locations. This means that either +you do not have GTK installed, you are missing GTK developer packages, +or you have installed GTK into custom location. In the latter case, +please rerun configure with --with-gtk-config=PREFIX. +GTK systray will be disabled. +EOF + echo -e "$(colour_default)"; + has_gtk=0; + fi; + if test $has_gtk = 1; then + echo -e "${colour_yes}\t\t\tyes${colour_default}"; + fi; +fi; +} + ## # Main script execution part. # @@ -352,6 +400,7 @@ check_wxconfig; check_wxversion; check_wxgtk2; +check_gtkconfig; check_ccache; gen_makefile; |
From: <ma...@us...> - 2003-12-18 09:26:51
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv770 Modified Files: TODO Log Message: Updated TODO list. Index: TODO =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/TODO,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- TODO 20 Sep 2003 16:03:30 -0000 1.7 +++ TODO 18 Dec 2003 09:26:48 -0000 1.8 @@ -1,27 +1,5 @@ -* Fix the memory leaks, detect with Valgrind or similar tools. * Copy lists data (single line and complete list). -* Sidebar - * Move sidebar code into a separate class CSideBar that is derived from - wxPanel. The class should contain at least the following methods: - CSideBar::CSideBar() // Constructor - CSideBar::AddSection() // Add a sub-panel with a button and content - CSideBar::RemoveSection() // Remove a subpanel with button and content - CSideBar::Show() // Show the sidebar - CSideBar::Hide() // Hide the sidebar - CSideBar::LoadSettings() // Load settings from config object at pointed location - CSideBar::SaveSettings() // Save settings to config object to pointed location - - Also, the following events should be declared and handled within this - class: - CSideBar::OnBtnSection() // Open or close a section depending on current state - - The following global variables should be declared within this class: - wxArray sections // Array to contain the list of sections - - Some parts of this code can be 'borrowed' from CServerWnd class. Once all this - is implemented, sidebars should be added to all pages of the interface, each - having relevant panels according to the page: - +* Recommended sidebar sections for pages: Server Page - Add servers - Update serverlist from URL @@ -46,3 +24,22 @@ Statistics Page - Update rate - Selection of graphs to display +* Find out what's the leaking `non-object data` that debug wx detects +* Splitter windows don't resize correct after switching to fullscreen +* Page detaching engine loses few wxMask/wxObject type objects during + the process, probably the toolbar buttons images. +* Fix toolbar/statusbar flickering on wxMSW. +* Hack wxToolBar to trigger EVT_LEFT_DOWN mouse events and use those + for changing pages instead of EVT_LEFT_CLICK - makes it seem + faster. +* Detached frames aren't affected by iconset changing. +* Listctrl's aren't affected by iconset changing. +* Remember toolbar buttons order between sessions, provide some nice + dialog for modifying it. +* Implement colour selection. Can use the same engine for runtime + updating as I used in CImages::UpdateImages(). +* Implement font selection. Can use the same engine for runtime + updating as I used in CImages::UpdateImages(). +* Implement a wxMac version of detaching engine (will probably need + to destroy the page and recreate in new frame). + |
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv24868 Modified Files: GUISettingsDlg.cpp Images.cpp Images.h MainDlg.cpp MainDlg.h Makefile.am defines.h wxInterface.cpp wxInterface.h Log Message: Finalized dialog pages detaching/attaching engine. Now dialog pages are stored in a wxList for dynamic updating. No more hard-coded toolbar ID codes or page order. Also improved documentation of CMainDlg class. Index: GUISettingsDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/GUISettingsDlg.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- GUISettingsDlg.cpp 6 Dec 2003 00:45:36 -0000 1.26 +++ GUISettingsDlg.cpp 18 Dec 2003 04:25:36 -0000 1.27 @@ -244,8 +244,7 @@ /* Update static bitmaps */ img->UpdateImages(mainframe); /* Recreate toolbar */ - img->MakeToolImages(); - mainframe->CreateMyToolBar(); + mainframe->CreateMyToolBar(true); /* Update server page logbook */ serverwnd->SetLogBookImages(); /* Update statistics tree */ @@ -255,9 +254,9 @@ wxIcon icon; icon.CopyFromBitmap(img->GetImage(wxT("mule"))); mainframe->SetIcon(icon); - #ifdef wxHAS_TASK_BAR_ICON +#ifdef wxHAS_TASK_BAR_ICON systray->SetIcon(icon); - #endif +#endif } } Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- Images.cpp 30 Nov 2003 23:19:59 -0000 1.32 +++ Images.cpp 18 Dec 2003 04:25:36 -0000 1.33 @@ -269,114 +269,6 @@ } /** - * Here we generate new toolbar button images. First we find out which of - * our texts is longest, and make the bitmap size according to that. Then - * we draw each bitmap with corresponding image and text and save to the - * corresponding image object (note that we should never save it to disc!). - * The main reason for this was wxMac where toolbar button texts were not - * supported, but eventually, this approach proves nicer quality because of - * possibility to later add custom background colour/borders to the images. - */ -void CImages::MakeToolImages() { - wxBitmap tmp, tmp_new; - wxMemoryDC mdc; - wxCoord x, y, width = 0, height = 0; - wxArrayString btntxt, btnimg; - - /* List of button names */ - btntxt.Add(_("Connect")); - btnimg.Add(wxT("btn_connect")); - btntxt.Add(_("Servers")); - btnimg.Add(wxT("btn_servers")); - btntxt.Add(_("Search")); - btnimg.Add(wxT("btn_search")); - btntxt.Add(_("Transfer")); - btnimg.Add(wxT("btn_transfer")); - btntxt.Add(_("Shared Files")); - btnimg.Add(wxT("btn_shared")); - btntxt.Add(_("Messaging")); - btnimg.Add(wxT("btn_messages")); - btntxt.Add(_("Statistics")); - btnimg.Add(wxT("btn_statistics")); - btntxt.Add(_("Preferences")); - btnimg.Add(wxT("btn_guisettings")); - - /** - * Temporary bitmap for measuring text lengths. - * 100 pixels should be enough. - */ - tmp = wxBitmap(100, 100); - mdc.SelectObject(tmp); - - /** - * Set font to what it will be in final bitmaps and measre the lengths - * of all button labels to find out the final width of the image. - * wxMac seems to have problems with wxDECORATIVE and/or wxBOLD - * fonts, we fall back to wxDEFAULT/wxNORMAL. - */ - mdc.SetTextForeground(wxColour(10, 10, 10)); - #ifdef __WXMAC__ - mdc.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL)); - #else - mdc.SetFont(wxFont(10, wxDECORATIVE, wxNORMAL, wxBOLD)); - #endif - for (unsigned int i=0;i<btntxt.GetCount();i++) { - mdc.GetTextExtent(btntxt.Item(i), &x, &y); - if (x > width) { - width = x; - } - } - /* local storage */ - width = width+6; - height = y+38; - /* global, for accessing from outside */ - tool_img_width = width; - tool_img_height = height; - - /** - * This forloop goes through all images previously named in btnimg - * string array. It creates a new image with previously calculated - * height and width, draws the found bitmap on it and the corresponding - * text from imgtxt arraystring. To make the final image transparent, - * wxLIGHT_GREY colour pointer is used on wxMSW which seems to give - * system background colour on windows, on other platforms we use - * simple transparency mask. Finally, the generated image is saved - * back to images list by removing old image, creating new wxBitmap - * type object and storing the pointer in the list. - */ - mdc.BeginDrawing(); - for (unsigned int i=0;i<btntxt.GetCount();i++) { - tmp_new = wxBitmap(width, height); - mdc.SelectObject(tmp_new); - #ifdef __WXMSW__ - mdc.SetPen(*wxTRANSPARENT_PEN); - mdc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); - #else - mdc.SetBrush(wxBrush(wxColour(0, 0, 0), wxSOLID)); - #endif - mdc.DrawRectangle( - 0, 0, tmp_new.GetWidth(), tmp_new.GetHeight() - ); - mdc.DrawBitmap( - GetImage(btnimg.Item(i)), - (tmp_new.GetWidth()-32)/2, 2, true - ); - mdc.SetTextForeground( wxColour(1,1,1)); - mdc.GetTextExtent(btntxt.Item(i), &x, &y); - mdc.DrawText(btntxt.Item(i), (tmp_new.GetWidth()-x)/2, 36); - #ifndef __WXMSW__ - wxMask *tmp_mask; - tmp_mask = new wxMask(tmp_new, wxColour(0,0,0)); - tmp_new.SetMask(tmp_mask); - #endif - images.DeleteObject(&(GetImage(btnimg.Item(i)))); - wxBitmap *new_image = new wxBitmap(tmp_new); - images.Append(btnimg.Item(i), new_image); - } - mdc.EndDrawing(); -} - -/** * This is an "Images Getter". It finds the requested image by searching * the image list by name. If not found, error message is generated, * but we still return the pointer (even if its illegal). @@ -410,4 +302,60 @@ for (unsigned int i=0;i<controls.GetCount();i++) { UpdateImages(controls.Item(i)->GetData()); } +} + +/** + * This method makes a new toolbar image. `name` is the label to be printed on + * the final image, `image` is a name of the image in Images list. we create + * a new wxBitmap object with width according to the length of width of `name`, + * and draw the bitmap+text on it. Finally, the generated image is saved back + * to Images list under the same name (previous version is deleted). + */ +wxBitmap& CImages::MakeToolImage(const wxString &name, const wxString &image) { + wxMemoryDC mdc; + wxBitmap tmp, tmp_new; + int x, y; + + tmp = wxBitmap(100, 100); + mdc.SelectObject(tmp); + + mdc.SetTextForeground(wxColour(10, 10, 10)); + #ifdef __WXMAC__ + mdc.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL)); + #else + mdc.SetFont(wxFont(10, wxDECORATIVE, wxNORMAL, wxBOLD)); + #endif + mdc.GetTextExtent(name, &x, &y); + + tmp_new = wxBitmap(x+6, y+36); + mdc.SelectObject(tmp_new); + + mdc.BeginDrawing(); + #ifdef __WXMSW__ /* This gives transparent image on wxMSW */ + mdc.SetPen(*wxTRANSPARENT_PEN); + mdc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); + #else /* Elsewhere, it will be done with wxMask later */ + mdc.SetBrush(wxBrush(wxColour(0, 0, 0), wxSOLID)); + #endif + mdc.DrawRectangle( + 0, 0, tmp_new.GetWidth(), tmp_new.GetHeight() + ); + mdc.DrawBitmap( + GetImage(image), + (tmp_new.GetWidth()-32)/2, 2, true + ); + mdc.SetTextForeground( wxColour(1,1,1)); + mdc.GetTextExtent(name, &x, &y); + mdc.DrawText(name, (tmp_new.GetWidth()-x)/2, 36); + #ifndef __WXMSW__ /* Use wxMask for transparency */ + wxMask *tmp_mask; + tmp_mask = new wxMask(tmp_new, wxColour(0,0,0)); + tmp_new.SetMask(tmp_mask); + #endif + mdc.EndDrawing(); + + images.DeleteObject(&(GetImage(image))); + wxBitmap *new_image = new wxBitmap(tmp_new); + images.Append(image, new_image); + return *new_image; } Index: Images.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Images.h 27 Nov 2003 13:52:51 -0000 1.15 +++ Images.h 18 Dec 2003 04:25:36 -0000 1.16 @@ -37,10 +37,10 @@ public: CImages(); virtual ~CImages(); - void MakeToolImages(); + wxBitmap& MakeToolImage(const wxString &name, const wxString &image); int tool_img_width, tool_img_height; void LoadImages(); - wxBitmap& GetImage(const wxString &name); + inline wxBitmap& GetImage(const wxString &name); void UpdateImages(wxWindow *parent); private: ListOfBitmaps images; Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- MainDlg.cpp 17 Dec 2003 10:15:21 -0000 1.26 +++ MainDlg.cpp 18 Dec 2003 04:25:36 -0000 1.27 @@ -30,7 +30,7 @@ #include "MainDlg.h" -/* Global classes */ +/* Forward delcaration of globally available classes */ class CServerWnd *serverwnd; class CTransferWnd *transferwnd; class CSearchWnd *searchwnd; @@ -43,82 +43,124 @@ class CStatusBar *statusbar; class CToolBar *toolbar; [...1195 lines suppressed...] +/* Second page adding method, this overloads previous one by using the */ +/* complete page structure as first argument. */ +/* IMPORTANT: This method does NOT generate toolbar image, while the other */ +/* method with same name does. */ +/* @new_page Pointer to Page structure - page to be added. */ +/* @update_bars If true, also updates toolbar/menubars as neccesery */ +/******************************************************************************/ +void CMainDlg::AddPage(Page *new_page, bool update_bars) { + if (new_page == NULL) { + wxFAIL_MSG(wxT("Empty page passed for adding!")); + return; + } + + pages.Append(new_page->short_title, new_page); + + if (update_bars) { + CreateMyToolBar(); + CreateMyMenuBar(); + } } Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- MainDlg.h 17 Dec 2003 09:47:35 -0000 1.11 +++ MainDlg.h 18 Dec 2003 04:25:36 -0000 1.12 @@ -47,6 +47,14 @@ #define ID_QUIT 100 #define ID_ABOUT wxID_ABOUT +struct Page { + wxPanel *content; + wxString short_title; + wxString long_title; + wxString image; + wxWindowID id; +}; + /** * This class is only needed for catching some specific events (see the event * table. Actual event handling is still done in CMainDlg. @@ -60,6 +68,7 @@ ); /* Constructor */ private: DECLARE_EVENT_TABLE() /* Event table declaration */ + void RightClick(wxMouseEvent &event); }; /* This very small class usually shows a frame with one dialog page as content*/ @@ -68,16 +77,18 @@ DetachedFrame( wxWindow *parent, wxWindowID, const wxString &title, const wxPoint& pos, const wxSize& size, - long style, wxLocale &m_locale, wxWindow *content + long style, wxLocale &m_locale, Page *content ); /* Constructor */ wxLocale &m_locale; /* Localization variable */ private: DECLARE_EVENT_TABLE() /* Event table declaration */ void OnClose(wxCommandEvent &event); /* Window closing event */ - wxWindow *cnt; /* Contents of the frame */ + Page *cnt; /* Contents of the frame */ }; -/* +WX_DECLARE_LIST(Page, PageList); + +/** * MainDlg class. The main dialog functions like Toolbar and Statusbar * stuff go in here. */ @@ -91,15 +102,17 @@ long style, wxLocale &m_locale ); /* Constructor */ ~CMainDlg(); /* Destructor */ - inline void CreateMyToolBar(); /* (re)Creates toolbar */ + inline void CreateMyToolBar(bool gen_images = false); /* Creates tbar */ inline void CreateMyMenuBar(); /* (re)Creates menubar */ + void AddPage( /* Adds new page to frame */ + wxPanel *page, const wxString &short_title, const wxString + &long_title, const wxString &image, wxWindowID = -1, + bool updatebars = false + ); + void AddPage(Page *page, bool updatebars = false); /* Adds new page */ + wxLocale &m_locale; /* Localization object */ - wxLocale &m_locale; - - /** - * These need to be publically available, other classes - * might need to access them. - */ + /* These need to be publically available */ wxStaticText* GetStatusText() { /* Statusbar text */ return (wxStaticText*) FindWindow( ID_STATUS_TXT ); } @@ -126,22 +139,24 @@ void MenuEvent(wxCommandEvent &event); /* Menubar events */ void ToolEvent(wxCommandEvent &event); /* Toolbar events */ void OnCloseWindow(wxCloseEvent &event); /* Window closing event */ - void ToolRightClick(wxMouseEvent &event);/* Toolbar right-click event */ void PopUpMenuEvents(wxCommandEvent &event);/* Tbar popup-menu events */ /* Member functions */ void CreateSysTray(); /* Creates system tray icon */ void LoadAndShowDialogPages(); /* Loads dialog pages */ void ConnectToAnyServer(); /* Sends "connect" command to core */ - inline bool ShowPage(wxWindow* dlg); /* Displays page `dlg` */ + inline bool SetActivePage(const wxString &to_show); /* Displays page */ void ShowGUISettingsDlg(); /* Displays GUI settings dialog */ - void UpdateToolButtons(); /* Updates toolbar buttons */ + void UpdateToolBar(); /* Updates toolbar buttons */ void UpdateMenuBar(); /* Updates menubar objects */ - void RemovePage(wxWindow *page); /* Removes `page` from frame */ + void RemovePage( /* Removes page `to_remove` */ + Page *to_remove, bool remove = true /* deleting contents if */ + ); /* `remove` is true */ void DetachCurPage(); /* Detaches current page into new frame */ + void ShowToolPopupMenu(); /* Displays toolbar popup menu */ - /* Getters */ - wxWindow* GetCurPage() { return activewnd; } + /* Getters - small methods for retreiving various kinds of data */ + Page* GetCurPage() { return cur_page;} /* Returns current active page */ wxMenuItem* GetViewMenuBar() { /* View menu object "View Menubar" */ return GetMenuBar()->FindItem(ID_VIEW_MENUBAR); } @@ -166,7 +181,6 @@ wxMenuItem* GetViewStatisticsWnd() {/* View menu object "Statisti..." */ return GetMenuBar()->FindItem(ID_VIEW_STATISTICS); } - wxStaticBitmap* GetBmpStatusConnection() {/* Statusbar connection bmp */ return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_CONNECTION ); } @@ -184,11 +198,10 @@ } /* Member variables */ - bool show_tool; /* Wether toolbar should be shown or not. */ bool start_up; /* Should we remember last page between sessions */ - int m_lastbtn; /* Last toggled toolbar button */ wxFlexGridSizer *m_mainsizer; /* Main frame sizer */ - wxWindow *activewnd; /* Current active dialog page */ + Page *cur_page; /* Current active dialog page */ + PageList pages; /* List of loaded dialog pages */ }; #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.am 17 Dec 2003 09:47:35 -0000 1.3 +++ Makefile.am 18 Dec 2003 04:25:36 -0000 1.4 @@ -31,10 +31,18 @@ @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_CPP_FLAGS@: $(ATTENTIONCOLOR)" @if @CXX@ @CXX_FLAGS@ @CPP_FLAGS@ @INCLUDE@ -c -o $@ $< 2>.err; then \ - echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ + if test -s .err; then \ + echo -e "$(WARNINGCOLOR)ok, but warnings:"; \ + cat .err; \ + rm -f .err; \ + echo -e "$(DEFAULTCOLOR)"; \ + else \ + echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ + fi; \ else \ echo -e "failed:"; \ cat .err; \ + rm -f .err; \ echo -e "$(DEFAULTCOLOR)"; \ false; \ fi; @@ -52,7 +60,7 @@ @echo -e -n "$(ACTIONCOLOR)Linking $(INPUTCOLOR)$(WXINTERFACE_OBJECTS)" @echo -e -n "$(ACTIONCOLOR)to $(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_LINK_FLAGS@: " @echo -e -n "$(ATTENTIONCOLOR)" - @if @CXX@ -o $(PROGRAM) $(WXINTERFACE_OBJECTS) @LIBS@; then \ + @if @CXX@ -o $(PROGRAM) $(WXINTERFACE_OBJECTS) @LIBS@ 2>.err; then \ echo -e "$(WELLCOLOR)ok."; \ echo -e -n "$(DEFAULTCOLOR)"; \ echo -e -n "$(WELLCOLOR)Successfully compiled "; \ @@ -60,6 +68,9 @@ echo -e -n "$(OUTPUTCOLOR)$@$(WELLCOLOR) binary!\n"; \ echo -e "$(DEFAULTCOLOR)Now cd to src/ dir and type $(OUTPUTCOLOR)./$@$(DEFAULTCOLOR) to start the application."; \ else \ + echo -e "failed:"; \ + cat .err; \ + echo -e "$(DEFAULTCOLOR)"; \ false; \ fi Index: defines.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/defines.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- defines.h 17 Dec 2003 09:47:35 -0000 1.41 +++ defines.h 18 Dec 2003 04:25:36 -0000 1.42 @@ -70,12 +70,13 @@ /* ID codes for our controls */ enum { - ID_BTN_CONNECT = 1000, /* Toolbar buttons */ - ID_BTN_SERVERS, - ID_BTN_TRANSFER, - ID_BTN_SEARCH, - ID_BTN_SHARED_FILES, - ID_BTN_MESSAGES, + ID_SERVERWND = 1000, /* Dialog pages */ + ID_SEARCHWND, + ID_TRANSFERWND, + ID_SHAREDFILESWND, + ID_MESSAGESWND, + ID_STATISTICSWND, + ID_BTN_CONNECT, /* Toolbar buttons */ ID_BTN_STATISTICS, ID_BTN_GUISETTINGS, ID_BTN_CORESETTINGS, @@ -175,5 +176,6 @@ */ M_LISTCOL = 2000 }; + #endif Index: wxInterface.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- wxInterface.cpp 8 Dec 2003 01:08:10 -0000 1.9 +++ wxInterface.cpp 18 Dec 2003 04:25:36 -0000 1.10 @@ -46,7 +46,8 @@ * main wxInterface Dialog drawn. */ bool wxInterface::OnInit() { - int show_splash; +int show_splash = true; + mainframe_active = false; SetVendorName(wxT("ShareDaemon")); SetAppName(wxT("wxInterface")); Index: wxInterface.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- wxInterface.h 8 Dec 2003 01:39:02 -0000 1.3 +++ wxInterface.h 18 Dec 2003 04:25:36 -0000 1.4 @@ -55,6 +55,7 @@ virtual int OnExit(); // Application shutdown CSplash *splash; // Pointer to splash screen bool splash_active; // For detecting if splash is active + bool mainframe_active; // For detecting if mainframe still exists protected: wxLocale m_locale; |
From: <ma...@us...> - 2003-12-17 10:15:24
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv9701 Modified Files: MainDlg.cpp ServerWnd.cpp Log Message: Formatting fix to keep under 80 chars Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- MainDlg.cpp 17 Dec 2003 09:47:35 -0000 1.25 +++ MainDlg.cpp 17 Dec 2003 10:15:21 -0000 1.26 @@ -608,7 +608,7 @@ return; } - m_config->Read(wxT("/General/Toolbar Alignment"), &tmp, wxTB_HORIZONTAL); + m_config->Read(wxT("/General/Toolbar Alignment"), &tmp,wxTB_HORIZONTAL); switch (tmp) { case wxTB_HORIZONTAL: GetMenuBar()->FindItem(ID_VIEW_TBAR_ALIGN_HOR)->Check(); @@ -833,26 +833,39 @@ break; case ID_RMENU_MENUBAR: if (GetMenuBar() == NULL) { - m_config->Write(wxT("/General/Show MenuBar"), true); + m_config->Write( + wxT("/General/Show MenuBar"), true + ); } else { - m_config->Write(wxT("/General/Show MenuBar"), false); + m_config->Write( + wxT("/General/Show MenuBar"), false + ); } CreateMyMenuBar(); break; case ID_RMENU_TOOLBAR: if (GetToolBar() == NULL) { - m_config->Write(wxT("/General/Show ToolBar"), true); + m_config->Write( + wxT("/General/Show ToolBar"), true + ); } else { - m_config->Write(wxT("/General/Show ToolBar"), false); + m_config->Write( + wxT("/General/Show ToolBar"), false + ); } CreateMyToolBar(); break; case ID_RMENU_TBAR_ALIGN_HOR: - m_config->Write(wxT("/General/Toolbar Alignment"), wxTB_HORIZONTAL); + m_config->Write( + wxT("/General/Toolbar Alignment"), + wxTB_HORIZONTAL + ); CreateMyToolBar(); break; case ID_RMENU_TBAR_ALIGN_VER: - m_config->Write(wxT("/General/Toolbar Alignment"), wxTB_VERTICAL); + m_config->Write( + wxT("/General/Toolbar Alignment"), wxTB_VERTICAL + ); CreateMyToolBar(); break; case ID_DETACH: Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- ServerWnd.cpp 17 Dec 2003 05:16:01 -0000 1.47 +++ ServerWnd.cpp 17 Dec 2003 10:15:21 -0000 1.48 @@ -241,12 +241,23 @@ wxFlexGridSizer *s_top_v = new wxFlexGridSizer(2); s_top_v->AddGrowableCol(0); wxComboBox *c_url = new wxComboBox(top_panel, ID_SERVERLISTURL); - c_url->Append(wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-best.met")); - c_url->Append(wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-good.met")); - c_url->Append(wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-max.met")); + c_url->Append( + wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/") + wxT("server.met?download/server-best.met") + ); + c_url->Append( + wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/") + wxT("server.met?download/server-good.met") + ); + c_url->Append( + wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/") + wxT("server.met?download/server-max.met") + ); c_url->SetSelection(0); #ifndef __WXX11__ - c_url->SetToolTip(_("Enter the URL or .met file location to update list from")); + c_url->SetToolTip( + _("Enter the URL or .met file location to update list from") + ); #endif s_top_v->Add(c_url, 0, wxGROW|wxEXPAND|wxALL, 0); wxButton *b_upd = new wxButton(top_panel, ID_UPDATE, _("Update")); |
From: <ma...@us...> - 2003-12-17 09:47:42
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv4751/src Modified Files: MainDlg.cpp MainDlg.h Makefile.am defines.h Log Message: * Toolbar context menu (right-click on empty space on toolbar to get it) * Fullscreen switch * Initial support for detaching dialog pages into separate frames (currently disabled by default due to its experimental nature) Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- MainDlg.cpp 17 Dec 2003 05:16:01 -0000 1.24 +++ MainDlg.cpp 17 Dec 2003 09:47:35 -0000 1.25 @@ -43,14 +43,62 @@ class CStatusBar *statusbar; class CToolBar *toolbar; -BEGIN_EVENT_TABLE(CMainDlg,wxFrame) - /* Shutdown event */ - EVT_CLOSE(CMainDlg::OnCloseWindow) - /* Menu/Toolbar events */ - EVT_TOOL(-1, CMainDlg::MenuOrToolEvent) +/******************************************************************************/ +/* MyToolBar class - only needed for event table - actual event handling is */ +/* done in CMainDlg. */ +/******************************************************************************/ +BEGIN_EVENT_TABLE(MyToolBar, wxToolBar) + EVT_RIGHT_DOWN(CMainDlg::ToolRightClick) /* Toolbar Rclick */ END_EVENT_TABLE() +/* Constructor - doesn't do anything */ +MyToolBar::MyToolBar( + wxWindow *parent, wxWindowID id, const wxPoint &pos, + const wxSize &size, long style +) : wxToolBar(parent, id, pos, size, style) { +} -/* +/******************************************************************************/ +/* DetachedFrame class */ +/******************************************************************************/ +BEGIN_EVENT_TABLE(DetachedFrame, wxFrame) + EVT_CLOSE(DetachedFrame::OnClose) +END_EVENT_TABLE() +/* Constructor - sets content of frame to what was passed to us in `content` */ +DetachedFrame::DetachedFrame( + wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &position, const wxSize& size, long style, + wxLocale &l, wxWindow *content +) : wxFrame( parent, id, title, position, size, style ), m_locale(l) { + cnt = content; + wxFlexGridSizer *s = new wxFlexGridSizer(1); + s->AddGrowableCol(0); + s->AddGrowableRow(0); + cnt->Reparent(this); + s->Add(cnt, 0, wxGROW|wxEXPAND|wxALL, 5); + SetSizer(s); + Layout(); + Show(); +} + +/* Frame close event - sends content back to main frame */ +void DetachedFrame::OnClose(wxCommandEvent &event) { + cnt->Hide(); + if (mainframe != NULL) { + cnt->Reparent(mainframe); + mainframe->CreateMyToolBar(); + } + Destroy(); +} + +/******************************************************************************/ +/* CMainDlg class */ +/******************************************************************************/ +BEGIN_EVENT_TABLE(CMainDlg, wxFrame) + EVT_CLOSE(CMainDlg::OnCloseWindow) /* Shutdown event */ + EVT_TOOL(-1, CMainDlg::MenuOrToolEvent) /* Menu/Toolbar events */ +END_EVENT_TABLE() + +/** * Main dialog constructor. Creates toolbar on the top, statusbar on the * bottom and loads the sub-dialogs (serverwnd, searchwnd etc). */ @@ -180,18 +228,12 @@ #endif /* Clean up our mess before leaving */ - delete serverwnd; - delete transferwnd; - delete searchwnd; - delete sharedfileswnd; - delete messageswnd; - delete statisticswnd; wxMenuBar *mb = GetMenuBar(); if (mb != NULL) { SetMenuBar(NULL); delete mb; } - wxToolBar *tb = GetToolBar(); + MyToolBar *tb = (MyToolBar*)GetToolBar(); if (tb != NULL) { SetToolBar(NULL); delete tb; @@ -232,7 +274,7 @@ int tool_align; /* Just in case we have some old toolbar hanging around, delete it. */ - wxToolBar *toolbar = GetToolBar(); + MyToolBar *toolbar = (MyToolBar*)GetToolBar(); delete toolbar; SetToolBar(NULL); @@ -247,8 +289,8 @@ ); /* Construct the toolbar object */ - wxToolBar *tb = new wxToolBar( - this, -1, wxDefaultPosition, wxDefaultSize, + MyToolBar *tb = new MyToolBar( + this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize, tool_align|wxNO_BORDER|wxTB_3DBUTTONS|wxTB_FLAT ); @@ -334,7 +376,7 @@ if ( wxMessageBox( _("Close ShareDaemon wxInterface?"), - _("Question"), + _("Question"), wxYES_NO|wxCENTRE|wxICON_QUESTION ) == wxNO) { return; @@ -561,25 +603,28 @@ * Here we update menubar view menu radio buttons. */ void CMainDlg::UpdateMenuBar() { -#ifdef wxHAS_RADIO_MENU_ITEMS + int tmp; if (GetMenuBar() == NULL) { return; } - if (GetCurPage() == serverwnd) { - GetViewServerWnd()->Check(); - } else if (GetCurPage() == searchwnd) { - GetViewSearchWnd()->Check(); - } else if (GetCurPage() == transferwnd) { - GetViewTransferWnd()->Check(); - } else if (GetCurPage() == sharedfileswnd) { - GetViewSharedWnd()->Check(); - } else if (GetCurPage() == messageswnd) { - GetViewMessagesWnd()->Check(); - } else if (GetCurPage() == statisticswnd) { - GetViewStatisticsWnd()->Check(); + m_config->Read(wxT("/General/Toolbar Alignment"), &tmp, wxTB_HORIZONTAL); + switch (tmp) { + case wxTB_HORIZONTAL: + GetMenuBar()->FindItem(ID_VIEW_TBAR_ALIGN_HOR)->Check(); + break; + case wxTB_VERTICAL: + GetMenuBar()->FindItem(ID_VIEW_TBAR_ALIGN_VER)->Check(); + break; + default: + break; } -#endif + + m_config->Read(wxT("/General/Show ToolBar"), &tmp, true); + GetMenuBar()->Check(ID_VIEW_TOOLBAR, tmp); + + m_config->Read(wxT("/General/Show MenuBar"), &tmp, false); + GetMenuBar()->Check(ID_VIEW_MENUBAR, tmp); } /** @@ -596,7 +641,7 @@ case ID_EDIT_GUI_SETTINGS: ShowGUISettingsDlg(); break; - case ID_VIEW_SERVERS: + case ID_VIEW_SERVERS: /* Menubar events */ ShowPage(serverwnd); break; case ID_VIEW_SEARCH: @@ -689,9 +734,185 @@ if (event.GetEventType() == wxEVT_COMMAND_TOOL_CLICKED) { ToolEvent(event); MenuEvent(event); + PopUpMenuEvents(event); UpdateToolButtons(); UpdateMenuBar(); } else { event.Skip(); } +} + +/** + * Called from MyToolBar class event table upon right mouse click event in + * toolbar, this method generates a popupmenu with various controls and + * displays it. + */ +void CMainDlg::ToolRightClick(wxMouseEvent &event) { + int tmp; /* Temporary storage for values read from config */ + + wxMenu *menu = new wxMenu(); /* Popup menu */ + + menu->Append(ID_RMENU_SERVERS, _("Servers")); + menu->Append(ID_RMENU_SEARCH, _("Search")); + menu->Append(ID_RMENU_TRANSFER, _("Transfer")); + menu->Append(ID_RMENU_SHARED_FILES, _("Shared Files")); + menu->Append(ID_RMENU_MESSAGES, _("Messages")); + menu->Append(ID_RMENU_STATISTICS, _("Statistics")); + menu->AppendSeparator(); + + menu->AppendCheckItem(ID_RMENU_MENUBAR, _("Show MenuBar")); + m_config->Read(wxT("/General/Show MenuBar"), &tmp, false); + if (tmp) { + menu->FindItem(ID_RMENU_MENUBAR)->Check(tmp); + } + + menu->AppendCheckItem(ID_RMENU_TOOLBAR, _("Show ToolBar")); + m_config->Read(wxT("/General/Show ToolBar"), &tmp, true); + if (tmp) { + menu->FindItem(ID_RMENU_TOOLBAR)->Check(tmp); + } + + wxMenu *tbar_menu = new wxMenu(); +#ifdef wxHAS_RADIO_MENU_ITEMS + tbar_menu->AppendRadioItem(ID_RMENU_TBAR_ALIGN_HOR, _("Horizontal")); + tbar_menu->AppendRadioItem(ID_RMENU_TBAR_ALIGN_VER, _("Vertical")); + m_config->Read(wxT("/General/Toolbar Alignment"), &tmp,wxTB_HORIZONTAL); + switch (tmp) { + case wxTB_HORIZONTAL: + tbar_menu->FindItem(ID_RMENU_TBAR_ALIGN_HOR)->Check(); + break; + case wxTB_VERTICAL: + tbar_menu->FindItem(ID_RMENU_TBAR_ALIGN_VER)->Check(); + break; + default: + break; + } +#else + tbar_menu->Append(ID_RMENU_TBAR_ALIGN_HOR, _("Horizontal")); + tbar_menu->Append(ID_RMENU_TBAR_ALIGN_VER, _("Vertical")); +#endif + menu->Append(ID_RMENU_TBAR, _("ToolBar Alignment"), tbar_menu); + menu->AppendSeparator(); +#if 0 /* Needs some work, disabled for now */ + menu->Append(ID_DETACH, _("Detach current page")); + menu->AppendSeparator(); +#endif + menu->Append(ID_EDIT_GUI_SETTINGS, _("Preferences")); + menu->Append(ID_FULLSCREEN, _("Fullscreen")); + menu->Append(ID_ABOUT, _("About...")); + menu->Append(ID_QUIT, _("Exit")); + + PopupMenu(menu, ScreenToClient(wxGetMousePosition())); + delete menu; +} + +/** + * Usually called from CMainDlg::MenuOrToolEvent, this filters out toolbar + * popup menu ID's from the event and handles them if neccesery. Otherwise, + * the event will be skipped to be handled by other handlers. + */ +void CMainDlg::PopUpMenuEvents(wxCommandEvent &event) { + switch (event.GetId()) { + case ID_RMENU_SERVERS: + ShowPage(serverwnd); + break; + case ID_RMENU_SEARCH: + ShowPage(searchwnd); + break; + case ID_RMENU_TRANSFER: + ShowPage(transferwnd); + break; + case ID_RMENU_SHARED_FILES: + ShowPage(sharedfileswnd); + break; + case ID_RMENU_MESSAGES: + ShowPage(messageswnd); + break; + case ID_RMENU_STATISTICS: + ShowPage(statisticswnd); + break; + case ID_RMENU_MENUBAR: + if (GetMenuBar() == NULL) { + m_config->Write(wxT("/General/Show MenuBar"), true); + } else { + m_config->Write(wxT("/General/Show MenuBar"), false); + } + CreateMyMenuBar(); + break; + case ID_RMENU_TOOLBAR: + if (GetToolBar() == NULL) { + m_config->Write(wxT("/General/Show ToolBar"), true); + } else { + m_config->Write(wxT("/General/Show ToolBar"), false); + } + CreateMyToolBar(); + break; + case ID_RMENU_TBAR_ALIGN_HOR: + m_config->Write(wxT("/General/Toolbar Alignment"), wxTB_HORIZONTAL); + CreateMyToolBar(); + break; + case ID_RMENU_TBAR_ALIGN_VER: + m_config->Write(wxT("/General/Toolbar Alignment"), wxTB_VERTICAL); + CreateMyToolBar(); + break; + case ID_DETACH: + DetachCurPage(); + break; + case ID_EDIT_GUI_SETTINGS: + ShowGUISettingsDlg(); + break; + case ID_FULLSCREEN: + if (!IsFullScreen()) { + ShowFullScreen(true); + } else { + ShowFullScreen(false); + } + break; + case ID_ABOUT: + break; + case ID_QUIT: + Close(); + break; + default: + event.Skip(); + break; + } +} + +/** + * This method removes target `page` from the frame by removing from main sizer + * and removing the corresponding toolbar button. We set start_up true here to + * trick ShowPage() method into thinking its startup and not call Remove... on + * the page anymore. + */ +void CMainDlg::RemovePage(wxWindow *page) { + m_mainsizer->Remove(page); + if (page == serverwnd) { + GetToolBar()->RemoveTool(ID_BTN_SERVERS); + } else if (page == searchwnd) { + GetToolBar()->RemoveTool(ID_BTN_SEARCH); + } else if (page == transferwnd) { + GetToolBar()->RemoveTool(ID_BTN_TRANSFER); + } else if (page == sharedfileswnd) { + GetToolBar()->RemoveTool(ID_BTN_SHARED_FILES); + } else if (page == messageswnd) { + GetToolBar()->RemoveTool(ID_BTN_MESSAGES); + } else if (page == statisticswnd) { + GetToolBar()->RemoveTool(ID_BTN_STATISTICS); + } + start_up = true; +} + +/** + * This method calls RemovePage() to remove current page from this frame and + * then proceeeds to create a new frame that will serve has host for the page + * from now on. + */ +void CMainDlg::DetachCurPage() { + RemovePage(GetCurPage()); + DetachedFrame *f = new DetachedFrame( + NULL, -1, GetCurPage()->GetName(), wxDefaultPosition, + wxSize(780, 580), wxDEFAULT_FRAME_STYLE| + wxNO_FULL_REPAINT_ON_RESIZE, m_locale, GetCurPage() + ); } Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- MainDlg.h 17 Dec 2003 05:16:01 -0000 1.10 +++ MainDlg.h 17 Dec 2003 09:47:35 -0000 1.11 @@ -43,112 +43,143 @@ #include "Images.h" #include "GUISettingsDlg.h" -/* - * Constants for MainDlg +/* Constants for MainDlg */ +#define ID_QUIT 100 +#define ID_ABOUT wxID_ABOUT + +/** + * This class is only needed for catching some specific events (see the event + * table. Actual event handling is still done in CMainDlg. */ +class MyToolBar : public wxToolBar { +public: + MyToolBar(wxWindow *parent, wxWindowID id = -1, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxTB_HORIZONTAL|wxNO_BORDER + ); /* Constructor */ +private: + DECLARE_EVENT_TABLE() /* Event table declaration */ +}; -#define ID_QUIT 100 -#define ID_ABOUT 101 +/* This very small class usually shows a frame with one dialog page as content*/ +class DetachedFrame : public wxFrame { +public: + DetachedFrame( + wxWindow *parent, wxWindowID, const wxString &title, + const wxPoint& pos, const wxSize& size, + long style, wxLocale &m_locale, wxWindow *content + ); /* Constructor */ + wxLocale &m_locale; /* Localization variable */ +private: + DECLARE_EVENT_TABLE() /* Event table declaration */ + void OnClose(wxCommandEvent &event); /* Window closing event */ + wxWindow *cnt; /* Contents of the frame */ +}; /* * MainDlg class. The main dialog functions like Toolbar and Statusbar * stuff go in here. */ extern class CMainDlg *mainframe; -class CMainDlg: public wxFrame -{ +class CMainDlg: public wxFrame { +friend class MyToolBar; public: /* Constructors and destructors */ CMainDlg( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint& pos, const wxSize& size, long style, wxLocale &m_locale - ); - ~CMainDlg(); - void CreateMyToolBar(); - void CreateMyMenuBar(); + ); /* Constructor */ + ~CMainDlg(); /* Destructor */ + inline void CreateMyToolBar(); /* (re)Creates toolbar */ + inline void CreateMyMenuBar(); /* (re)Creates menubar */ wxLocale &m_locale; - /** - * These need to be publically available, other classes - * might need to access them. + /** + * These need to be publically available, other classes + * might need to access them. */ - wxStaticText* GetStatusText() { - return (wxStaticText*) FindWindow( ID_STATUS_TXT ); + wxStaticText* GetStatusText() { /* Statusbar text */ + return (wxStaticText*) FindWindow( ID_STATUS_TXT ); } - wxStaticText* GetStatusUsers() { - return (wxStaticText*) FindWindow( ID_STATUS_USERS ); + wxStaticText* GetStatusUsers() { /* Statusbar users count number */ + return (wxStaticText*) FindWindow( ID_STATUS_USERS ); } - wxStaticText* GetStatusFiles() { - return (wxStaticText*) FindWindow( ID_STATUS_FILES ); + wxStaticText* GetStatusFiles() { /* Statusbar files count number */ + return (wxStaticText*) FindWindow( ID_STATUS_FILES ); } - wxStaticText* GetStatusUpload() { - return (wxStaticText*) FindWindow( ID_STATUS_UPLOAD ); + wxStaticText* GetStatusUpload() { /* Statusbar upload speed number */ + return (wxStaticText*) FindWindow( ID_STATUS_UPLOAD ); } - wxStaticText* GetStatusDload() { - return (wxStaticText*) FindWindow( ID_STATUS_DLOAD ); + wxStaticText* GetStatusDload() { /* Statusbar dload speed number */ + return (wxStaticText*) FindWindow( ID_STATUS_DLOAD ); } - wxStaticText* GetStatusConnection() { - return (wxStaticText*) FindWindow( ID_STATUS_CONNECTION ); + wxStaticText* GetStatusConnection() { /* Statusbar server name text */ + return (wxStaticText*) FindWindow( ID_STATUS_CONNECTION ); } private: DECLARE_EVENT_TABLE() /* Member event handler functions */ - void MenuOrToolEvent(wxCommandEvent &event); - void MenuEvent(wxCommandEvent &event); - void ToolEvent(wxCommandEvent &event); - void OnCloseWindow(wxCloseEvent &event); + void MenuOrToolEvent(wxCommandEvent &event); /* All tbar/mbar events */ + void MenuEvent(wxCommandEvent &event); /* Menubar events */ + void ToolEvent(wxCommandEvent &event); /* Toolbar events */ + void OnCloseWindow(wxCloseEvent &event); /* Window closing event */ + void ToolRightClick(wxMouseEvent &event);/* Toolbar right-click event */ + void PopUpMenuEvents(wxCommandEvent &event);/* Tbar popup-menu events */ /* Member functions */ - void CreateSysTray(); - void LoadAndShowDialogPages(); - void ConnectToAnyServer(); - bool ShowPage(wxWindow* dlg); - void ShowGUISettingsDlg(); - void UpdateToolButtons(); - void UpdateMenuBar(); + void CreateSysTray(); /* Creates system tray icon */ + void LoadAndShowDialogPages(); /* Loads dialog pages */ + void ConnectToAnyServer(); /* Sends "connect" command to core */ + inline bool ShowPage(wxWindow* dlg); /* Displays page `dlg` */ + void ShowGUISettingsDlg(); /* Displays GUI settings dialog */ + void UpdateToolButtons(); /* Updates toolbar buttons */ + void UpdateMenuBar(); /* Updates menubar objects */ + void RemovePage(wxWindow *page); /* Removes `page` from frame */ + void DetachCurPage(); /* Detaches current page into new frame */ /* Getters */ wxWindow* GetCurPage() { return activewnd; } - wxMenuItem* GetViewMenuBar() { + wxMenuItem* GetViewMenuBar() { /* View menu object "View Menubar" */ return GetMenuBar()->FindItem(ID_VIEW_MENUBAR); } - wxMenuItem* GetViewToolBar() { + wxMenuItem* GetViewToolBar() { /* View menu object "View Toolbar" */ return GetMenuBar()->FindItem(ID_VIEW_TOOLBAR); } - wxMenuItem* GetViewServerWnd() { + wxMenuItem* GetViewServerWnd() { /* View menu object "Server Page" */ return GetMenuBar()->FindItem(ID_VIEW_SERVERS); } - wxMenuItem* GetViewSearchWnd() { + wxMenuItem* GetViewSearchWnd() { /* View menu object "Search Page" */ return GetMenuBar()->FindItem(ID_VIEW_SEARCH); } - wxMenuItem* GetViewTransferWnd() { + wxMenuItem* GetViewTransferWnd() {/* View menu object "Transfer Page" */ return GetMenuBar()->FindItem(ID_VIEW_TRANSFER); } - wxMenuItem* GetViewSharedWnd() { + wxMenuItem* GetViewSharedWnd() {/* View menu object "Shared Files..." */ return GetMenuBar()->FindItem(ID_VIEW_SHARED_FILES); } - wxMenuItem* GetViewMessagesWnd() { + wxMenuItem* GetViewMessagesWnd() {/* View menu object "Messages P..." */ return GetMenuBar()->FindItem(ID_VIEW_MESSAGES); } - wxMenuItem* GetViewStatisticsWnd() { + wxMenuItem* GetViewStatisticsWnd() {/* View menu object "Statisti..." */ return GetMenuBar()->FindItem(ID_VIEW_STATISTICS); } - wxStaticBitmap* GetBmpStatusConnection() { + wxStaticBitmap* GetBmpStatusConnection() {/* Statusbar connection bmp */ return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_CONNECTION ); } - wxStaticBitmap* GetBmpStatusDload() { + wxStaticBitmap* GetBmpStatusDload() { /* Statusbar download bitmap */ return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_DLOAD ); } - wxStaticBitmap* GetBmpStatusUpload() { + wxStaticBitmap* GetBmpStatusUpload() { /* Statusbar upload bitmap */ return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_UPLOAD ); } - wxStaticBitmap* GetBmpStatusFiles() { + wxStaticBitmap* GetBmpStatusFiles() { /* Statusbar files bitmap */ return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_FILES ); } - wxStaticBitmap* GetBmpStatusUsers() { + wxStaticBitmap* GetBmpStatusUsers() { /* Statusbar users bitmap */ return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_USERS ); } Index: Makefile.am =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 12 Dec 2003 10:36:10 -0000 1.2 +++ Makefile.am 17 Dec 2003 09:47:35 -0000 1.3 @@ -30,9 +30,12 @@ .cpp.o : @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_CPP_FLAGS@: $(ATTENTIONCOLOR)" - @if @CXX@ @CXX_FLAGS@ @CPP_FLAGS@ @INCLUDE@ -c -o $@ $<; then \ + @if @CXX@ @CXX_FLAGS@ @CPP_FLAGS@ @INCLUDE@ -c -o $@ $< 2>.err; then \ echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ else \ + echo -e "failed:"; \ + cat .err; \ + echo -e "$(DEFAULTCOLOR)"; \ false; \ fi; Index: defines.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/defines.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- defines.h 17 Dec 2003 05:16:01 -0000 1.40 +++ defines.h 17 Dec 2003 09:47:35 -0000 1.41 @@ -70,7 +70,7 @@ /* ID codes for our controls */ enum { - ID_BTN_CONNECT = 1000, + ID_BTN_CONNECT = 1000, /* Toolbar buttons */ ID_BTN_SERVERS, ID_BTN_TRANSFER, ID_BTN_SEARCH, @@ -79,13 +79,16 @@ ID_BTN_STATISTICS, ID_BTN_GUISETTINGS, ID_BTN_CORESETTINGS, + ID_TOOLBAR, /* Toolbar itself */ + ID_DETACH, /* Deatch_Current_page menubar object */ + ID_FULLSCREEN, /* Fullscreen switch (in menu) */ /* Menubar */ - ID_FILE_CONNECT, + ID_FILE_CONNECT, /* Menubar file menu items */ ID_FILE_EXIT, - ID_EDIT_GUI_SETTINGS, + ID_EDIT_GUI_SETTINGS, /* Menubar edit menu items */ ID_EDIT_CORE_SETTINGS, - ID_VIEW_SERVERS, + ID_VIEW_SERVERS, /* Menubar view menu items */ ID_VIEW_TRANSFER, ID_VIEW_SEARCH, ID_VIEW_SHARED_FILES, @@ -96,8 +99,21 @@ ID_VIEW_TBAR, ID_VIEW_TBAR_ALIGN_HOR, ID_VIEW_TBAR_ALIGN_VER, - ID_HELP_HELP, + ID_HELP_HELP, /* Menubar help menu items */ ID_HELP_ABOUT, + + /* Toolbar popup menu */ + ID_RMENU_SERVERS, + ID_RMENU_TRANSFER, + ID_RMENU_SEARCH, + ID_RMENU_SHARED_FILES, + ID_RMENU_MESSAGES, + ID_RMENU_STATISTICS, + ID_RMENU_MENUBAR, + ID_RMENU_TOOLBAR, + ID_RMENU_TBAR_ALIGN_HOR, + ID_RMENU_TBAR_ALIGN_VER, + ID_RMENU_TBAR, /* Server page */ ID_SERVER_SPLITTER_HORIZONTAL, |
From: <ma...@us...> - 2003-12-17 09:47:38
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv4751 Modified Files: Changelog Log Message: * Toolbar context menu (right-click on empty space on toolbar to get it) * Fullscreen switch * Initial support for detaching dialog pages into separate frames (currently disabled by default due to its experimental nature) Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- Changelog 12 Dec 2003 08:37:48 -0000 1.105 +++ Changelog 17 Dec 2003 09:47:35 -0000 1.106 @@ -21,6 +21,14 @@ # ALL ChangeLog entries end with a dot. # ############################################################################### +2003/17/12 Alo Sarv + * Serverpage look enhancements + * Toolbar right-click popup menu (right-click on empty space in tbar) + * Fullscreen mode switch + * Initial support for detaching dialog pages and displaying them as + separate frame (disabled by default due to its experimental + nature). + 2003/13/12 Alo Sarv * Configure script |
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv29276 Modified Files: MainDlg.cpp MainDlg.h ServerListCtrl.cpp ServerListCtrl.h ServerWnd.cpp defines.h wxInterface.wdr wxInterface_wdr.cpp wxInterface_wdr.h Log Message: .wdr cleanup && minor serverpage look enhancements Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- MainDlg.cpp 8 Dec 2003 01:08:10 -0000 1.23 +++ MainDlg.cpp 17 Dec 2003 05:16:01 -0000 1.24 @@ -80,7 +80,10 @@ #endif /* This adds a new sizer in the frame to make switching pages easier. */ - m_mainsizer = ContentSizer(this, true); + m_mainsizer = new wxFlexGridSizer(1); + m_mainsizer->AddGrowableCol(0); + m_mainsizer->AddGrowableRow(0); + SetSizer(m_mainsizer); /** * Read position and size settings, and apply them before Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- MainDlg.h 8 Dec 2003 01:39:02 -0000 1.9 +++ MainDlg.h 17 Dec 2003 05:16:01 -0000 1.10 @@ -108,9 +108,9 @@ void ShowGUISettingsDlg(); void UpdateToolButtons(); void UpdateMenuBar(); - wxWindow* GetCurPage() { return activewnd; } /* Getters */ + wxWindow* GetCurPage() { return activewnd; } wxMenuItem* GetViewMenuBar() { return GetMenuBar()->FindItem(ID_VIEW_MENUBAR); } @@ -153,12 +153,11 @@ } /* Member variables */ - bool show_tool; // Wether toolbar should be shown or not. - bool start_up; // Should we remember last page - // between sessions or not - int m_lastbtn; // Last toggled toolbar button - wxSizer *m_mainsizer; // Sizer to make dialog pages switching easier. - wxWindow *activewnd; // Current active dialog page + bool show_tool; /* Wether toolbar should be shown or not. */ + bool start_up; /* Should we remember last page between sessions */ + int m_lastbtn; /* Last toggled toolbar button */ + wxFlexGridSizer *m_mainsizer; /* Main frame sizer */ + wxWindow *activewnd; /* Current active dialog page */ }; #endif Index: ServerListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerListCtrl.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ServerListCtrl.cpp 27 Nov 2003 08:23:12 -0000 1.11 +++ ServerListCtrl.cpp 17 Dec 2003 05:16:01 -0000 1.12 @@ -39,9 +39,10 @@ * column layout. */ CServerListCtrl::CServerListCtrl( - wxWindow*& parent,int id,const wxPoint& pos,wxSize siz,int flags + wxWindow* parent, wxWindowID id, const wxPoint& pos, + const wxSize& siz, long style ) -: CMListCtrl(parent,id,pos,siz,flags) { +: CMListCtrl(parent, id, pos, siz, style) { /** * Generate the columns for this list control. To add or remove * columns, modify the col_headers array, but make sure the Index: ServerListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerListCtrl.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ServerListCtrl.h 24 Nov 2003 16:06:32 -0000 1.8 +++ ServerListCtrl.h 17 Dec 2003 05:16:01 -0000 1.9 @@ -38,8 +38,12 @@ class CServerListCtrl: public CMListCtrl { public: - CServerListCtrl(wxWindow*& parent,int id,const wxPoint& pos, - wxSize siz,int flags); + CServerListCtrl( + wxWindow* parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize &siz = wxDefaultSize, + long style = wxNO_FULL_REPAINT_ON_RESIZE + ); virtual ~CServerListCtrl(); void AddItem(wxArrayString fields_data); Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- ServerWnd.cpp 17 Dec 2003 04:05:41 -0000 1.46 +++ ServerWnd.cpp 17 Dec 2003 05:16:01 -0000 1.47 @@ -182,25 +182,15 @@ sbmain->SetSizeHints(sidebar); /* Add the sidebar to mainsizer. */ - mainsizer->Add(sidebar, 0, wxGROW|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 0); + mainsizer->Add(sidebar, 0, wxGROW|wxADJUST_MINSIZE, 5); - /** - * Create new CSBPanel object which provides framework for - * opening/closing the section, set its content and add to - * sidebar. - */ + /* Sidebar sections */ CSBPanel *addserver = new CSBPanel( sidebar, -1, _("Add new server"), wxT("SideBar_AddServer") ); addserver->SetContent(AddServerPanel(addserver, false, false)); sbmain->Add(addserver, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); - CSBPanel *updatelist = new CSBPanel( - sidebar, -1, _("Update from URL"), wxT("SideBar_UpdateServer") - ); - updatelist->SetContent(UpdatePanel(updatelist, false, false)); - sbmain->Add(updatelist, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); - CSBPanel *serversettings = new CSBPanel( sidebar, -1, _("Server settings"), wxT("SideBar_ServerSettings") ); @@ -221,7 +211,7 @@ /* Button to toggle sidebar on/off */ wxButton *toggler = new wxButton( - this, ID_BTN_TOGGLE_SIDEBAR, wxT("<"), + this, ID_BTN_TOGGLE_SIDEBAR, wxT("<"), wxDefaultPosition, wxSize(12, 100) ); toggler->SetFont(wxFont(14, wxNORMAL, wxNORMAL, wxBOLD)); @@ -233,7 +223,7 @@ /* Splitter window */ splatter = new wxSplitterWindow( - this, ID_SERVER_SPLITTER_HORIZONTAL, wxDefaultPosition, + this, ID_SERVER_SPLITTER_HORIZONTAL, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_NOBORDER|wxSP_LIVE_UPDATE| wxNO_FULL_REPAINT_ON_RESIZE ); @@ -244,13 +234,82 @@ wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL ); - Server_List(top_panel, false, true); + wxFlexGridSizer *s_top = new wxFlexGridSizer(1); + s_top->AddGrowableCol(0); + s_top->AddGrowableRow(1); + + wxFlexGridSizer *s_top_v = new wxFlexGridSizer(2); + s_top_v->AddGrowableCol(0); + wxComboBox *c_url = new wxComboBox(top_panel, ID_SERVERLISTURL); + c_url->Append(wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-best.met")); + c_url->Append(wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-good.met")); + c_url->Append(wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-max.met")); + c_url->SetSelection(0); +#ifndef __WXX11__ + c_url->SetToolTip(_("Enter the URL or .met file location to update list from")); +#endif + s_top_v->Add(c_url, 0, wxGROW|wxEXPAND|wxALL, 0); + wxButton *b_upd = new wxButton(top_panel, ID_UPDATE, _("Update")); + s_top_v->Add(b_upd, 0, wxGROW|wxEXPAND|wxRIGHT, 5); + s_top->Add(s_top_v, 0, wxGROW|wxEXPAND|wxALL, 0); + + CServerListCtrl *serverlist = new CServerListCtrl( + top_panel, -1, wxDefaultPosition, wxDefaultSize, + wxLC_REPORT|wxSUNKEN_BORDER|wxNO_FULL_REPAINT_ON_RESIZE + ); + s_top->Add(serverlist, 0, wxGROW|wxEXPAND|wxRIGHT, 5); + top_panel->SetSizer(s_top); /* Bottom Panel */ bottom_panel = new wxPanel(splatter, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL); - Server_Logs( bottom_panel, false, true); + wxFlexGridSizer *s_bottom = new wxFlexGridSizer(1); + s_bottom->AddGrowableCol(0); + s_bottom->AddGrowableRow(0); + wxNotebook *logs = new wxNotebook( + bottom_panel, ID_LOGBOOK, wxDefaultPosition, wxDefaultSize, + wxNO_FULL_REPAINT_ON_RESIZE + ); + wxNotebookSizer *s_logs = new wxNotebookSizer(logs); + wxImageList *imgs = new wxImageList(16, 16); + imgs->Add(img->GetImage(wxT("log"))); + logs->AssignImageList(imgs); + + /* General logs panel */ + wxPanel *p_logs = new wxPanel( + logs, -1, wxDefaultPosition, wxDefaultSize, + wxNO_FULL_REPAINT_ON_RESIZE + ); + wxFlexGridSizer *sf_logs = new wxFlexGridSizer(1); + sf_logs->AddGrowableCol(0); + sf_logs->AddGrowableRow(0); + wxTextCtrl *txt_logs = new wxTextCtrl( + p_logs, ID_LOG, wxEmptyString, wxDefaultPosition, + wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY + ); + sf_logs->Add(txt_logs, 0, wxGROW|wxALL|wxEXPAND, 0); + p_logs->SetSizer(sf_logs); + logs->AddPage(p_logs, _("Log"), true, 0); + + /* Debug logs panel */ + wxPanel *p_dlogs = new wxPanel( + logs, -1, wxDefaultPosition, wxDefaultSize, + wxNO_FULL_REPAINT_ON_RESIZE + ); + wxFlexGridSizer *sf_dlogs = new wxFlexGridSizer(1); + sf_dlogs->AddGrowableCol(0); + sf_dlogs->AddGrowableRow(0); + wxTextCtrl *txt_dlogs = new wxTextCtrl( + p_dlogs, ID_DEBUGLOG, wxEmptyString, wxDefaultPosition, + wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY + ); + sf_dlogs->Add(txt_dlogs, 0, wxGROW|wxALL|wxEXPAND, 0); + p_dlogs->SetSizer(sf_dlogs); + logs->AddPage(p_dlogs, _("Debug Log"), false, 0); + + s_bottom->Add(s_logs, 0, wxGROW|wxEXPAND|wxTOP|wxRIGHT, 5); + bottom_panel->SetSizer(s_bottom); /* Split the window and add to sizer */ splatter->SplitHorizontally( top_panel, bottom_panel, @@ -532,41 +591,6 @@ item0->Fit( parent ); item0->SetSizeHints( parent ); } - } - - return item0; -} - -wxSizer* CServerWnd::UpdatePanel( - wxWindow *parent, bool call_fit, bool set_sizer -) { - wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); - - wxTextCtrl *item1 = new wxTextCtrl( - parent, ID_SERVERLISTURL, - wxT("http://ocbmaurice.dyndns.org/pl/slist.pl/server.met\ - ?download/server-best.met"), wxDefaultPosition, - wxSize(-1,100), wxTE_MULTILINE|wxTE_PROCESS_TAB - ); -#ifndef __WXX11__ - item1->SetToolTip( - wxT("Enter the URL or .met file location to update list from")); -#endif - item0->Add( item1, 0, wxGROW, 5 ); - - wxButton *item2 = new wxButton( - parent, ID_UPDATE, _("Update"), - wxDefaultPosition, wxDefaultSize, 0 - ); - item0->Add( item2, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxTOP, 5 ); - - if (set_sizer) { - parent->SetAutoLayout( TRUE ); - parent->SetSizer( item0 ); - if (call_fit) { - item0->Fit( parent ); - item0->SetSizeHints( parent ); - } } return item0; Index: defines.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/defines.h,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- defines.h 27 Nov 2003 08:23:12 -0000 1.39 +++ defines.h 17 Dec 2003 05:16:01 -0000 1.40 @@ -65,8 +65,9 @@ extern class CToolBar *toolbar; extern wxConfigBase *m_config; #ifdef wxHAS_TASK_BAR_ICON - extern class CSysTray *systray; +extern class CSysTray *systray; #endif + /* ID codes for our controls */ enum { ID_BTN_CONNECT = 1000, @@ -116,6 +117,9 @@ ID_UPDATE, ID_SERVERLISTURL, ID_CHECK_DISABLE_UDP, + ID_LOGBOOK, + ID_LOG, + ID_DEBUGLOG, /* Transfer page */ ID_SPLITTER, Index: wxInterface.wdr =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface.wdr,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 Binary files /tmp/cvs8u8j4d and /tmp/cvsGwZ7Jh differ Index: wxInterface_wdr.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface_wdr.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- wxInterface_wdr.cpp 30 Nov 2003 20:38:36 -0000 1.9 +++ wxInterface_wdr.cpp 17 Dec 2003 05:16:01 -0000 1.10 @@ -48,81 +48,6 @@ // Implement window functions -wxSizer *Server_List( wxWindow *parent, bool call_fit, bool set_sizer ) -{ - wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 ); - item0->AddGrowableCol( 0 ); - item0->AddGrowableRow( 0 ); - - wxFlexGridSizer *item1 = new wxFlexGridSizer( 1, 0, 0 ); - item1->AddGrowableCol( 0 ); - item1->AddGrowableRow( 0 ); - - CServerListCtrl *item2 = new CServerListCtrl( parent, ID_SERVERLISTCTRL, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER ); - item1->Add( item2, 0, wxGROW|wxRIGHT|wxTOP, 5 ); - - item0->Add( item1, 0, wxGROW, 5 ); - - if (set_sizer) - { - parent->SetAutoLayout( TRUE ); - parent->SetSizer( item0 ); - if (call_fit) - { - item0->Fit( parent ); - item0->SetSizeHints( parent ); - } - } - - return item0; -} - -wxSizer *Log( wxWindow *parent, bool call_fit, bool set_sizer ) -{ - wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 ); - item0->AddGrowableCol( 0 ); - item0->AddGrowableRow( 0 ); - - wxTextCtrl *item1 = new wxTextCtrl( parent, ID_LOG, wxT(""), wxDefaultPosition, wxSize(80,40), wxTE_MULTILINE|wxTE_READONLY ); - item0->Add( item1, 0, wxGROW, 5 ); - - if (set_sizer) - { - parent->SetAutoLayout( TRUE ); - parent->SetSizer( item0 ); - if (call_fit) - { - item0->Fit( parent ); - item0->SetSizeHints( parent ); - } - } - - return item0; -} - -wxSizer *DebugLog( wxWindow *parent, bool call_fit, bool set_sizer ) -{ - wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 ); - item0->AddGrowableCol( 0 ); - item0->AddGrowableRow( 0 ); - - wxTextCtrl *item1 = new wxTextCtrl( parent, ID_DEBUGLOG, wxT(""), wxDefaultPosition, wxSize(80,40), wxTE_MULTILINE|wxTE_READONLY ); - item0->Add( item1, 0, wxGROW, 5 ); - - if (set_sizer) - { - parent->SetAutoLayout( TRUE ); - parent->SetSizer( item0 ); - if (call_fit) - { - item0->Fit( parent ); - item0->SetSizeHints( parent ); - } - } - - return item0; -} - wxSizer *SearchWnd( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 6, 0, 0, 0 ); @@ -316,26 +241,6 @@ return item0; } -wxSizer *ContentSizer( wxWindow *parent, bool call_fit, bool set_sizer ) -{ - wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 ); - item0->AddGrowableCol( 0 ); - item0->AddGrowableRow( 0 ); - - if (set_sizer) - { - parent->SetAutoLayout( TRUE ); - parent->SetSizer( item0 ); - if (call_fit) - { - item0->Fit( parent ); - item0->SetSizeHints( parent ); - } - } - - return item0; -} - wxSizer *SharedFilesWnd( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 4, 0, 0, 0 ); @@ -728,39 +633,6 @@ item20->Add( item48, 0, wxGROW|wxTOP, 5 ); item0->Add( item20, 0, wxGROW|wxALL, 5 ); - - if (set_sizer) - { - parent->SetAutoLayout( TRUE ); - parent->SetSizer( item0 ); - if (call_fit) - { - item0->Fit( parent ); - item0->SetSizeHints( parent ); - } - } - - return item0; -} - -wxSizer *Server_Logs( wxWindow *parent, bool call_fit, bool set_sizer ) -{ - wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 ); - item0->AddGrowableCol( 0 ); - item0->AddGrowableRow( 0 ); - - wxNotebook *item2 = new wxNotebook( parent, ID_LOGBOOK, wxDefaultPosition, wxDefaultSize, 0 ); - wxNotebookSizer *item1 = new wxNotebookSizer( item2 ); - - wxPanel *item3 = new wxPanel( item2, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE ); - Log( item3, FALSE ); - item2->AddPage( item3, _("Log") ); - - wxPanel *item4 = new wxPanel( item2, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE ); - DebugLog( item4, FALSE ); - item2->AddPage( item4, _("Debug Log") ); - - item0->Add( item1, 0, wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 5 ); if (set_sizer) { Index: wxInterface_wdr.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface_wdr.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- wxInterface_wdr.h 24 Nov 2003 16:06:32 -0000 1.4 +++ wxInterface_wdr.h 17 Dec 2003 05:16:01 -0000 1.5 @@ -28,91 +28,77 @@ // Declare window functions -#define ID_SERVERLISTCTRL 10000 -wxSizer *Server_List( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); - -#define ID_LOG 10001 -wxSizer *Log( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); - -#define ID_DEBUGLOG 10002 -wxSizer *DebugLog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); - -#define ID_TEXT 10003 -#define ID_SEARCHSTRING 10004 -#define ID_SEARCHMETHOD 10005 -#define ID_SEARCHTYPE 10006 -#define ID_BTN_RESET 10007 -#define ID_MINSIZE 10008 -#define ID_MAXSIZE 10009 -#define ID_AVAIL 10010 -#define ID_EXTENSION 10011 -#define ID_TEXTCTRL 10012 -#define ID_SEARCH_RESULTS_IMAGE 10013 -#define ID_BUTTON 10014 -#define ID_SEARCHRESULTS 10015 -#define ID_GAUGE 10016 +#define ID_TEXT 10000 +#define ID_SEARCHSTRING 10001 +#define ID_SEARCHMETHOD 10002 +#define ID_SEARCHTYPE 10003 +#define ID_BTN_RESET 10004 +#define ID_MINSIZE 10005 +#define ID_MAXSIZE 10006 +#define ID_AVAIL 10007 +#define ID_EXTENSION 10008 +#define ID_TEXTCTRL 10009 +#define ID_SEARCH_RESULTS_IMAGE 10010 +#define ID_BUTTON 10011 +#define ID_SEARCHRESULTS 10012 +#define ID_GAUGE 10013 wxSizer *SearchWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); -wxSizer *ContentSizer( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); - -#define ID_SHARED_FILES_IMAGE 10017 -#define ID_TXT_SHARED 10018 -#define ID_SHAREDLISTCTRL 10019 -#define ID_CURSES_REQUESTS 10020 -#define ID_CURSES_ACCEPTED_UPLOADS 10021 -#define ID_CURSES_TRANSFERRED 10022 -#define ID_G_REQUESTS 10023 -#define ID_G_UPLOADS 10024 -#define ID_G_TRANSFERRED 10025 -#define ID_TOTAL_REQUESTS 10026 -#define ID_TOTAL_ACCEPTED_UPLOADS 10027 -#define ID_TOTAL_TRANSFERRED 10028 +#define ID_SHARED_FILES_IMAGE 10014 +#define ID_TXT_SHARED 10015 +#define ID_SHAREDLISTCTRL 10016 +#define ID_CURSES_REQUESTS 10017 +#define ID_CURSES_ACCEPTED_UPLOADS 10018 +#define ID_CURSES_TRANSFERRED 10019 +#define ID_G_REQUESTS 10020 +#define ID_G_UPLOADS 10021 +#define ID_G_TRANSFERRED 10022 +#define ID_TOTAL_REQUESTS 10023 +#define ID_TOTAL_ACCEPTED_UPLOADS 10024 +#define ID_TOTAL_TRANSFERRED 10025 wxSizer *SharedFilesWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); -#define ID_FRIEND_IMAGE 10029 -#define ID_LISTCTRL 10030 -#define ID_MESSAGES_IMAGE 10031 -#define ID_NOTEBOOK 10032 +#define ID_FRIEND_IMAGE 10026 +#define ID_LISTCTRL 10027 +#define ID_MESSAGES_IMAGE 10028 +#define ID_NOTEBOOK 10029 wxSizer *MessagesWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); -#define BTN_STAT 10033 -#define ID_STATSTREECTRL 10034 -#define ID_FOREIGN 10035 -#define ID_CON_GRAPH 10036 -#define ID_DL_SES 10037 -#define ID_DL_CUR 10038 -#define ID_DL_AVG 10039 -#define ID_DL_GRAPH 10040 -#define ID_UL_SES 10041 -#define ID_UL_CUR 10042 -#define ID_UL_AVG 10043 -#define ID_UL_GRAPH 10044 +#define BTN_STAT 10030 +#define ID_STATSTREECTRL 10031 +#define ID_FOREIGN 10032 +#define ID_CON_GRAPH 10033 +#define ID_DL_SES 10034 +#define ID_DL_CUR 10035 +#define ID_DL_AVG 10036 +#define ID_DL_GRAPH 10037 +#define ID_UL_SES 10038 +#define ID_UL_CUR 10039 +#define ID_UL_AVG 10040 +#define ID_UL_GRAPH 10041 wxSizer *StatisticsWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); -#define ID_LOGBOOK 10045 -wxSizer *Server_Logs( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); - -#define ID_LANG_NAME 10046 -#define ID_BTN_ADD_LANG_OK 10047 -#define ID_BTN_ADD_LANG_CANCEL 10048 +#define ID_LANG_NAME 10042 +#define ID_BTN_ADD_LANG_OK 10043 +#define ID_BTN_ADD_LANG_CANCEL 10044 wxSizer *Dlg_AddLanguage( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); -#define ID_BTN_ADDICONSET_OK 10049 -#define ID_BTN_ADDICONSET_CANCEL 10050 +#define ID_BTN_ADDICONSET_OK 10045 +#define ID_BTN_ADDICONSET_CANCEL 10046 wxSizer *Dlg_AddIconSet( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); -#define ID_LINE 10051 -#define ID_STATUS_TXT 10052 -#define ID_BMP_STATUS_USERS 10053 -#define ID_STATUS_USERS 10054 -#define ID_BMP_STATUS_FILES 10055 -#define ID_STATUS_FILES 10056 -#define ID_BMP_STATUS_UPLOAD 10057 -#define ID_STATUS_UPLOAD 10058 -#define ID_BMP_STATUS_DLOAD 10059 -#define ID_STATUS_DLOAD 10060 -#define ID_BMP_STATUS_CONNECTION 10061 -#define ID_STATUS_CONNECTION 10062 +#define ID_LINE 10047 +#define ID_STATUS_TXT 10048 +#define ID_BMP_STATUS_USERS 10049 +#define ID_STATUS_USERS 10050 +#define ID_BMP_STATUS_FILES 10051 +#define ID_STATUS_FILES 10052 +#define ID_BMP_STATUS_UPLOAD 10053 +#define ID_STATUS_UPLOAD 10054 +#define ID_BMP_STATUS_DLOAD 10055 +#define ID_STATUS_DLOAD 10056 +#define ID_BMP_STATUS_CONNECTION 10057 +#define ID_STATUS_CONNECTION 10058 wxSizer *StatusBar( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); // Declare menubar functions @@ -121,7 +107,7 @@ // Declare bitmap functions -#define ID_NULL_BMP 10063 +#define ID_NULL_BMP 10059 wxBitmap Icons( size_t index ); #endif |
From: <ma...@us...> - 2003-12-17 04:05:44
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv19518 Modified Files: SBPanel.cpp ServerWnd.cpp Log Message: Two minor sidebar fixes Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SBPanel.cpp 6 Dec 2003 00:18:37 -0000 1.4 +++ SBPanel.cpp 17 Dec 2003 04:05:41 -0000 1.5 @@ -96,6 +96,7 @@ shown = true; } GetParent()->Layout(); + wxGetTopLevelParent(this)->Layout(); } /** Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- ServerWnd.cpp 6 Dec 2003 00:45:36 -0000 1.45 +++ ServerWnd.cpp 17 Dec 2003 04:05:41 -0000 1.46 @@ -193,13 +193,7 @@ sidebar, -1, _("Add new server"), wxT("SideBar_AddServer") ); addserver->SetContent(AddServerPanel(addserver, false, false)); - - /* Need to use border 0 on wxMSW to have correct layout */ - #ifdef __WXMSW__ - sbmain->Add(addserver, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); - #else - sbmain->Add(addserver, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 5); - #endif + sbmain->Add(addserver, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); CSBPanel *updatelist = new CSBPanel( sidebar, -1, _("Update from URL"), wxT("SideBar_UpdateServer") |
From: <ma...@us...> - 2003-12-17 03:56:22
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv17948 Modified Files: configure Log Message: typo fix Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- configure 12 Dec 2003 20:30:19 -0000 1.4 +++ configure 17 Dec 2003 03:56:19 -0000 1.5 @@ -105,7 +105,7 @@ if test $patch_sizer = 0; then echo -e "\t${colour_warning}Warning: Sidebar hiding code will be disabled. To enable it,${colour_default}"; echo -e "\t${colour_warning}get wxWindows >=v2.5.1, or patch it with flexgridsizer.patch and${colour_default}"; - echo -e "\t${colour_warning}recompile it and re-run this configure with --has-patched-sizer.${colour_default}"; + echo -e "\t${colour_warning}recompile it and re-run this configure with --has-patched-wxsizer.${colour_default}"; fi; } |
From: <bo...@us...> - 2003-12-16 22:47:25
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv25219 Modified Files: Makefile.cvs osdep.h Log Message: Fixed new compilation problems on MingW32 Index: Makefile.cvs =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Makefile.cvs,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Makefile.cvs 8 Dec 2003 20:07:41 -0000 1.14 +++ Makefile.cvs 16 Dec 2003 22:47:21 -0000 1.15 @@ -49,7 +49,7 @@ ifdef WIN32 CXX = g++ -b i686-mingw32msvc CC = gcc -b i686-mingw32msvc -LDFLAGS += -lwsock32 +LDFLAGS += -lwsock32 -lmingwex BINARY = test.exe CPPFLAGS += -DWIN32 endif @@ -57,17 +57,19 @@ ifdef LINUX BINARY = test CPPFLAGS += -DLINUX +CFLAGS += -std=c99 endif ifdef MACOSX BINARY = test CPPFLAGS += -DMACOSX +CFLAGS += -std=c99 endif all: $(BINARY) -CFLAGS += -g -Wall -O3 -std=c99 +CFLAGS += -g -Wall -O3 CXXFLAGS += -g -Wall -O3 CPPFLAGS += -DXMULE2 LDFLAGS += -g -lm Index: osdep.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- osdep.h 12 Dec 2003 18:20:21 -0000 1.14 +++ osdep.h 16 Dec 2003 22:47:21 -0000 1.15 @@ -88,6 +88,9 @@ #define sleep(x) Sleep(1000*x) //_sleep +#define S_ISLNK(x) (false) +#define lstat stat + static inline int ioctl(int d, int request, int * x) { unsigned long y=*x; return ioctlsocket(d,request,&y); |
From: <bo...@us...> - 2003-12-13 05:06:21
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv24471 Modified Files: ParseClass.cpp Log Message: Fixed a bug which caused a structure to be not initialied on some circumstances (and thus causing a crash Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ParseClass.cpp 12 Dec 2003 18:20:21 -0000 1.15 +++ ParseClass.cpp 13 Dec 2003 05:06:15 -0000 1.16 @@ -760,7 +760,6 @@ struct write_struct * & last ) const { const struct parsestruct * ps; - struct write_struct * prev; size_t i,done; u8 * dataptr; @@ -777,10 +776,6 @@ // NonArray: for (i=0;i<nume;++i) { for (ps=type;ps;ps=ps->next) { - prev=last; - last->next=new struct write_struct; - last=last->next; - if (ps->flags&PF_ARRAY0 || ps->type_id==STRUCT) { u32 num; @@ -805,13 +800,15 @@ return call_done; } - delete last; - prev->next=call_first; + last->next=call_first; last=call_last; done +=call_done; } } else { + last->next=new struct write_struct; + last=last->next; + switch (ps->type_id) { case WORD: last->data=new u8[2]; @@ -850,6 +847,7 @@ return done; Array: + struct write_struct * prev; size_t n=nume; struct tag * tag; u8 * ptr; |
From: <ma...@us...> - 2003-12-12 20:30:23
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv4802 Modified Files: configure Log Message: Now detects wx2.5.1 (for sizer patch) Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- configure 12 Dec 2003 10:36:10 -0000 1.3 +++ configure 12 Dec 2003 20:30:19 -0000 1.4 @@ -89,6 +89,24 @@ echo -e "${colour_no}no${colour_default}"; wrong_version; fi; + + if test $patch_sizer = 0; then + if test $wxversion_major = 2; then + if test $wxversion_minor -ge 5; then + if test $wxversion_patch -ge 1; then + patch_sizer=1; + fi; + fi; + elif test $wxversion_major = 3; then + patch_sizer=1; + fi; + fi; + + if test $patch_sizer = 0; then + echo -e "\t${colour_warning}Warning: Sidebar hiding code will be disabled. To enable it,${colour_default}"; + echo -e "\t${colour_warning}get wxWindows >=v2.5.1, or patch it with flexgridsizer.patch and${colour_default}"; + echo -e "\t${colour_warning}recompile it and re-run this configure with --has-patched-sizer.${colour_default}"; + fi; } ## @@ -98,7 +116,7 @@ echo -e -n "checking if wxWindows was linked against GTK2..."; if $wxconfig --cppflags | grep -q 'gtk2' ; then echo -e "${colour_no}yes${colour_default}"; - echo -e "\t${colour_warning}GTK2 support in wxWindows is currently only experimental,${colour_default}"; + echo -e "\t${colour_warning}Warning: GTK2 support in wxWindows is only experimental,${colour_default}"; echo -e "\t${colour_warning}thus it is not officially supported in this application${colour_default}"; echo -e "\t${colour_warning}either. You have been warned, continue on your own risc.${colour_default}"; else @@ -160,6 +178,10 @@ echo "FLAGCOLOR =\33[37;1m" >> src/Makefile fi; + if test $patch_sizer = 1; then + cppflags="$cppflags -D__HAVE_REMOVE_GROWABLE_COL__" + fi; + sed -e "\ s#@CXX@#$ccache `$wxconfig --cxx`#; \ s#@CXX_FLAGS@#`$wxconfig --cxxflags`#; \ @@ -290,12 +312,8 @@ echo -e -n "checking for --has-patched-wxsizer\t\t"; if test $patch_sizer = 1; then echo -e "${colour_yes}yes${colour_default}"; - cppflags="$cppflags -D__HAVE_REMOVE_GROWABLE_COL__" else echo -e "${colour_no}no${colour_default}"; - echo -e "\t${colour_warning}Warning: Sidebar hiding code will be disabled. To enable${colour_default}"; - echo -e "\t${colour_warning}it, patch wxWindows with flexgridsizer.patch, recompile${colour_default}"; - echo -e "\t${colour_warning}it and re-run this configure with --has-patched-sizer.${colour_default}"; fi; echo -e -n "checking for --show-flags\t\t\t"; |
From: <bo...@us...> - 2003-12-12 18:20:24
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv11584 Modified Files: ParseClass.cpp osdep.h Log Message: Fixed some errors of initial implementaion of Write - but there are still serious errors left Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ParseClass.cpp 12 Dec 2003 16:48:54 -0000 1.14 +++ ParseClass.cpp 12 Dec 2003 18:20:21 -0000 1.15 @@ -649,6 +649,32 @@ ); } + /* + * Checking functionality: Write this instance back to a + * buffer, to see, if read/write is compatible. + */ + + u8 *cmp_buffer; + size_t cmp_buffsize; + + if (!Write(&cmp_buffer,&cmp_buffsize)) { + fprintf(stderr, + "%s:%s:%i: Warning: Write failed!\n" + ,__FILE__,__FUNCTION__,__LINE__ + ); + } else { + if (buffsize!=cmp_buffsize + || memcmp(buffer,cmp_buffer,buffsize)) { + fprintf(stderr, + "%s:%s:%i: Fatal: Write didn't return the " + "same data as just being Read in.\n" + ,__FILE__,__FUNCTION__,__LINE__ + ); + Write("wrondata.met"); + exit(1); + } + } + return true; } @@ -802,8 +828,8 @@ case IPPORT: last->data=new u8[6]; last->free=true; - *(u32*)(last->data )=htob32(*(u32*)dataptr ); - *(u16*)(last->data+4)=htol16(*(u16*)dataptr+4); + *(u32*)(last->data )=htob32(*(u32*)(dataptr )); + *(u16*)(last->data+4)=htol16(*(u16*)(dataptr+4)); break; default: @@ -843,12 +869,11 @@ n; ++tag,--n ) { - last->size=1+2+tag->id_len; - prev=last; last->next=new struct write_struct; last=last->next; + last->size=1+2+tag->id_len; ptr=last->data=new u8[last->size+4]; last->free=true; @@ -878,6 +903,7 @@ *(u16*)ptr=htol16(tag->value.string.length); + done+=last->size; prev=last; last->next=new struct write_struct; last=last->next; @@ -966,7 +992,8 @@ *buffer=new u8[*buffsize]; i=0; while (first) { - memcpy(buffer+i,first->data,first->size); + assert(i+first->size<=*buffsize); + memcpy(*buffer+i,first->data,first->size); i+=first->size; if (first->free) { Index: osdep.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- osdep.h 12 Dec 2003 16:48:54 -0000 1.13 +++ osdep.h 12 Dec 2003 18:20:21 -0000 1.14 @@ -58,10 +58,10 @@ #define btoh32(x) ntohl(x) #define htol16(x) bswap16(htons(x)) -#define htol32(x) bswap32(htons(x)) +#define htol32(x) bswap32(htonl(x)) #define ntol16(x) bswap16(x) #define ntol32(x) bswap32(x) -#define htob32(x) htons(x) +#define htob32(x) htonl(x) #ifdef MACOSX #include <sys/types.h> |
From: <bo...@us...> - 2003-12-12 16:48:58
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv25603 Modified Files: ParseClass.cpp ParseClass.h osdep.h Log Message: Initial implementation of ParseClass::Write methods Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ParseClass.cpp 11 Dec 2003 02:56:49 -0000 1.13 +++ ParseClass.cpp 12 Dec 2003 16:48:54 -0000 1.14 @@ -713,8 +713,272 @@ return rc; } +struct write_struct { + u8 *data; + size_t size; + struct write_struct *next; + bool free; +}; + +/* + const struct parsestruct * type; // (Sub)type of this data + unsigned char * data; // Pointer to the actual data + size_t size; // Num chars per element + size_t numPCs; // Num PCs @ the end of each element + size_t nume; // Num elements (for array) + const class ParseClass * parent; +*/ + +size_t ParseClass::IncrementalWrite( + struct write_struct * & first, + struct write_struct * & last +) const { + const struct parsestruct * ps; + struct write_struct * prev; + size_t i,done; + u8 * dataptr; + + done=0; + dataptr=data; + + first=last=new struct write_struct; + first->size=0; + first->data=NULL; + first->free=false; + + if (IsArray()) goto Array; + +// NonArray: + for (i=0;i<nume;++i) { + for (ps=type;ps;ps=ps->next) { + prev=last; + last->next=new struct write_struct; + last=last->next; + + if (ps->flags&PF_ARRAY0 + || ps->type_id==STRUCT) { + u32 num; + + Get(num,i,ps->counter_var->varname); + + if (num) { + size_t call_done; + struct write_struct *call_first; + struct write_struct *call_last; + + ParseClass * * PC; + + PC=FirstParseClassPointer(i); + PC+=ps->referer_id; + + call_done=(*PC)->IncrementalWrite( + call_first,call_last + ); + if (call_done==(size_t)-1) { + /* FIXME: Here is a Memory Leak! */ + return call_done; + } + + delete last; + prev->next=call_first; + last=call_last; + + done +=call_done; + } + } else { + switch (ps->type_id) { + case WORD: + last->data=new u8[2]; + last->free=true; + *(u16*)(last->data )=htol16(*(u16*)dataptr ); + break; + + case DWORD: + last->data=new u8[4]; + last->free=true; + *(u32*)(last->data )=htol32(*(u32*)dataptr ); + break; + + case IPPORT: + last->data=new u8[6]; + last->free=true; + *(u32*)(last->data )=htob32(*(u32*)dataptr ); + *(u16*)(last->data+4)=htol16(*(u16*)dataptr+4); + break; + + default: + last->data=dataptr; + last->free=false; + } + + dataptr +=ps->size; + done +=last->size=ps->size; + } + } + + dataptr+=numPCs*sizeof(ParseClass*); + } + + last->next=NULL; + + return done; + +Array: + size_t n=nume; + struct tag * tag; + u8 * ptr; + + if (type->type_id==BITMAP) { + fprintf( + stderr, + "%s:%s:%i: Fatal: ParseClass::IncrementalWrite is " + "not implemented for type->type_id==BITMAP.\n" + ,__FILE__,__FUNCTION__,__LINE__ + ); + exit(1); + } + if (type->type_id==TAG) { + for ( + tag=reinterpret_cast<struct tag *>(data); + n; + ++tag,--n + ) { + last->size=1+2+tag->id_len; + + prev=last; + last->next=new struct write_struct; + last=last->next; + + ptr=last->data=new u8[last->size+4]; + last->free=true; + + *ptr++=tag->type; + *(u16*)ptr=htol16(tag->id_len); + ptr+=2; + + if (!tag->id_len) { + fprintf( + stderr, + "%s:%s:%i: Fatal: ParseClass::" + "IncrementalWrite: Type id len = 0.\n" + ,__FILE__,__FUNCTION__,__LINE__ + ); + exit(1); + } + if (tag->id_len==1) { + *ptr++=tag->id.number; + } else { + memcpy(ptr,tag->id.string,tag->id_len); + ptr+=tag->id_len; + } + + switch (tag->type) { + case 2: // STRING + last->size+=2; + + *(u16*)ptr=htol16(tag->value.string.length); + + prev=last; + last->next=new struct write_struct; + last=last->next; + + last->data=tag->value.string.content; + last->size=tag->value.string.length; + last->free=false; + + break; + + case 3: + last->size+=4; + + *(u32*)ptr=htol32(tag->value.dword); + + break; + + default: + fprintf( + stderr, + "%s:%s:%i: Fatal: ParseClass::" + "IncrementalRead: Unknown tag " + "type %i\n" + ,__FILE__,__FUNCTION__,__LINE__ + ,tag->type + ); + exit(1); + } + + done+=last->size; + } + } else { + done+=last->size=size*n; + last->free=true; + + switch (type->type_id) { + case WORD: + last->data=new u8[last->size]; + + while (n--) { + *(u16*)(last->data+size*n )=htol16(*(u16*)(data+size*n )); + } + + break; + + case DWORD: + last->data=new u8[last->size]; + + while (n--) { + *(u32*)(last->data+size*n )=htol32(*(u32*)(data+size*n )); + } + + break; + + case IPPORT: + last->data=new u8[last->size]; + + while (n--) { + *(u32*)(last->data+size*n )=htob32(*(u32*)(data+size*n )); + *(u16*)(last->data+size*n+4)=htol16(*(u16*)(data+size*n+4)); + } + + break; + + default: + last->data=data; + last->free=false; + + break; + } + } + + last->next=NULL; + + return done; +} + bool ParseClass::Write(u8 * * buffer,size_t * buffsize) const { + struct write_struct *first, *last; + size_t i; + + if (((size_t)-1)==(*buffsize=IncrementalWrite(first,last))) { + return false; + } + *buffer=new u8[*buffsize]; + i=0; + while (first) { + memcpy(buffer+i,first->data,first->size); + i+=first->size; + + if (first->free) { + delete[] first->data; + } + + last=first; + first=first->next; + delete last; + } + + return true; } bool ParseClass::Write(Ed2kPacket & p,u8 protocol,u8 opcode) const { Index: ParseClass.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ParseClass.h 9 Dec 2003 00:16:29 -0000 1.11 +++ ParseClass.h 12 Dec 2003 16:48:54 -0000 1.12 @@ -225,6 +225,11 @@ size_t IncrementalReadNonArray(const u8 * buffer,size_t buffsize); size_t IncrementalReadArray(const u8 * buffer,size_t buffsize); + size_t IncrementalWrite( + struct write_struct * & first, + struct write_struct * & last + ) const; + template <class D,class S> void GetCast(D & dst,const S & src) const { fprintf(stderr,"%s:%s:%i: FATAL: Cannot cast types.\n" ,__FILE__,__FUNCTION__,__LINE__ Index: osdep.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- osdep.h 11 Dec 2003 02:57:20 -0000 1.12 +++ osdep.h 12 Dec 2003 16:48:54 -0000 1.13 @@ -38,20 +38,30 @@ * l = little endian * b = big endian */ -#define ltoh32(x) ntohl(lton32(x)) -#define lton32(little_endian) ( \ - (((little_endian )&(u32)0xff)<<24) \ - |(((little_endian>> 8)&(u32)0xff)<<16) \ - |(((little_endian>>16)&(u32)0xff)<< 8) \ - |(((little_endian>>24)&(u32)0xff) ) \ + +#define bswap16(x) ( \ + ((((x) )&(u16)0xff)<< 8) \ + |((((x)>> 8)&(u16)0xff) ) \ ) -#define ltoh16(x) ntohs(lton16(x)) -#define lton16(little_endian) ( \ - (((little_endian )&(u16)0xff)<< 8) \ - |(((little_endian>> 8)&(u16)0xff) ) \ + +#define bswap32(x) ( \ + ((((x) )&(u32)0xff)<<24) \ + |((((x)>> 8)&(u32)0xff)<<16) \ + |((((x)>>16)&(u32)0xff)<< 8) \ + |((((x)>>24)&(u32)0xff) ) \ ) + +#define ltoh32(x) ntohl(lton32(x)) +#define lton32(x) bswap32(x) +#define ltoh16(x) ntohs(lton16(x)) +#define lton16(x) bswap16(x) #define btoh32(x) ntohl(x) +#define htol16(x) bswap16(htons(x)) +#define htol32(x) bswap32(htons(x)) +#define ntol16(x) bswap16(x) +#define ntol32(x) bswap32(x) +#define htob32(x) htons(x) #ifdef MACOSX #include <sys/types.h> |
From: <ma...@us...> - 2003-12-12 10:36:14
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv22770/src Modified Files: Makefile.am Log Message: --disable-colours switch and wxGTK2 check+warning Index: Makefile.am =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 12 Dec 2003 08:37:48 -0000 1.1 +++ Makefile.am 12 Dec 2003 10:36:10 -0000 1.2 @@ -1,17 +1,5 @@ PROGRAM = wxInterface -# Colours -DEFAULTCOLOR =\33[0;22m -ACTIONCOLOR = \33[0;2m -ATTENTIONCOLOR=\33[31;22m -FAILEDCOLOR = -WARNINGCOLOR =\33[33;22m -NOTICEGCOLOR =\33[33;2m -WELLCOLOR =\33[32;22m -OUTPUTCOLOR =\33[35;1m -INPUTCOLOR =\33[34;1m -FLAGCOLOR =\33[37;1m - WXINTERFACE_OBJECTS = ColorFrameCtrl.o \ DownloadListCtrl.o \ GUISettingsDlg.o \ |
From: <ma...@us...> - 2003-12-12 10:36:14
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv22770 Modified Files: configure Log Message: --disable-colours switch and wxGTK2 check+warning Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- configure 12 Dec 2003 09:12:18 -0000 1.2 +++ configure 12 Dec 2003 10:36:10 -0000 1.3 @@ -19,12 +19,6 @@ #!/bin/sh -colour_default="\33[0;2m" -colour_yes="\33[32;22m" -colour_no="\33[31;22m" -colour_output="\33[35;1m" -colour_warning="\33[36;1m" - ## # Checks for ccache (compiler cache) availability # @@ -98,6 +92,21 @@ } ## +# Checks if wxWindows library was linked against GTK2 +# +function check_wxgtk2() { + echo -e -n "checking if wxWindows was linked against GTK2..."; + if $wxconfig --cppflags | grep -q 'gtk2' ; then + echo -e "${colour_no}yes${colour_default}"; + echo -e "\t${colour_warning}GTK2 support in wxWindows is currently only experimental,${colour_default}"; + echo -e "\t${colour_warning}thus it is not officially supported in this application${colour_default}"; + echo -e "\t${colour_warning}either. You have been warned, continue on your own risc.${colour_default}"; + else + echo -e "${colour_yes}no${colour_default}"; + fi; +} + +## # Outputs error message about wx-config not being found, and prints suggestions. # function not_found() { @@ -136,8 +145,21 @@ echo "creating Makefile"; cp -f Makefile.am Makefile; echo "creating src/Makefile"; - echo "# Automatically generated by configure - from Makefile.am" \ - "do not modify!" > src/Makefile; + echo "" > src/Makefile; + echo "# Automatically generated by configure - from Makefile.am do not modify!" > src/Makefile + if test $colours = 1; then + echo "# Colours" >> src/Makefile + echo "DEFAULTCOLOR =\33[0;22m" >> src/Makefile + echo "ACTIONCOLOR = \33[0;2m" >> src/Makefile + echo "ATTENTIONCOLOR=\33[31;22m" >> src/Makefile + echo "WARNINGCOLOR =\33[33;22m" >> src/Makefile + echo "NOTICEGCOLOR =\33[33;2m" >> src/Makefile + echo "WELLCOLOR =\33[32;22m" >> src/Makefile + echo "OUTPUTCOLOR =\33[35;1m" >> src/Makefile + echo "INPUTCOLOR =\33[34;1m" >> src/Makefile + echo "FLAGCOLOR =\33[37;1m" >> src/Makefile + fi; + sed -e "\ s#@CXX@#$ccache `$wxconfig --cxx`#; \ s#@CXX_FLAGS@#`$wxconfig --cxxflags`#; \ @@ -163,6 +185,7 @@ profile=0; show_flags=0; patch_sizer=0; + colours=1; while test $# -gt 0; do case $1 in @@ -211,6 +234,12 @@ --hide-flags) show_flags=0; ;; + --disable-colours) + colours=0; + ;; + --enable-colours) + colours=1; + ;; *) print_help; ;; @@ -218,6 +247,18 @@ shift; done; + echo -e -n "checking for --disable-colours\t\t\t"; + if test $colours = 1; then + colour_default="\33[0;2m" + colour_yes="\33[32;22m" + colour_no="\33[31;22m" + colour_output="\33[35;1m" + colour_warning="\33[36;1m" + echo -e "${colour_yes}no${colour_default}"; + else + echo -e "yes"; + fi; + echo -e "checking for --with-wx-config\t\t\t$wxconfig"; echo -e "checking for --prefix\t\t\t\t$prefix"; echo -e "checking for --include-dir\t\t\t$include_dir"; @@ -252,7 +293,9 @@ cppflags="$cppflags -D__HAVE_REMOVE_GROWABLE_COL__" else echo -e "${colour_no}no${colour_default}"; - echo -e "\t${colour_warning}Warning: Sidebar hiding code will be disabled.${colour_default}"; + echo -e "\t${colour_warning}Warning: Sidebar hiding code will be disabled. To enable${colour_default}"; + echo -e "\t${colour_warning}it, patch wxWindows with flexgridsizer.patch, recompile${colour_default}"; + echo -e "\t${colour_warning}it and re-run this configure with --has-patched-sizer.${colour_default}"; fi; echo -e -n "checking for --show-flags\t\t\t"; @@ -279,6 +322,7 @@ --has-patched-wxsizer wxWindows is patched with flexgridsizer patch ( enables sidebar hiding code ) --show-flags Enable printing compilation/link flags + --disable-colours Disable colours in configure/make output EOF exit 0; } @@ -289,7 +333,8 @@ parse_cmdline $@; check_wxconfig; check_wxversion; +check_wxgtk2; check_ccache; gen_makefile; -echo -e "configure complete. Now type \33[35;1mmake\33[0;2m and pray."; +echo -e "configure complete. Now type ${colour_output}make${colour_default} and pray."; |
From: <ma...@us...> - 2003-12-12 09:12:21
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv10561 Modified Files: configure Log Message: colours Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- configure 12 Dec 2003 08:37:48 -0000 1.1 +++ configure 12 Dec 2003 09:12:18 -0000 1.2 @@ -19,6 +19,12 @@ #!/bin/sh +colour_default="\33[0;2m" +colour_yes="\33[32;22m" +colour_no="\33[31;22m" +colour_output="\33[35;1m" +colour_warning="\33[36;1m" + ## # Checks for ccache (compiler cache) availability # @@ -26,18 +32,18 @@ echo -n -e "checking for ccache...\t\t\t\t"; if test -x /usr/local/bin/ccache; then ccache=/usr/local/bin/ccache; - echo "yes"; + echo -e "${colour_yes}yes${colour_default}"; elif test -x /usr/bin/ccache; then ccache=/usr/bin/ccache; - echo "yes" + echo -e "${colour_yes}yes${colour_default}" elif test -x /local/bin/ccache; then ccache=/local/bin/ccache; - echo "yes" + echo -e "${colour_yes}yes${colour_default}" elif test -x /bin/ccache; then ccache=/bin/ccache; - echo "yes" + echo -e "${colour_yes}yes${colour_default}" else - echo "no"; + echo -e "${colour_no}no${colour_default}"; fi; } @@ -62,10 +68,10 @@ elif test -x /wx/dynamic/2.5.0/bin/wx-config; then wxconfig=/wx/dynamic/2.5.0/bin/wx-config; else - echo "no"; + echo "${colour_no}no${colour_default}"; not_found; fi; - echo "yes"; + echo -e "${colour_yes}yes${colour_default}"; } ## @@ -83,10 +89,10 @@ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test $wxversion_major -ge 2 -a $wxversion_minor -ge 0; then - echo "yes" \ + echo -e "${colour_yes}yes${colour_default}" \ "($wxversion_major.$wxversion_minor.$wxversion_patch)"; else - echo "no"; + echo -e "${colour_no}no${colour_default}"; wrong_version; fi; } @@ -150,6 +156,8 @@ # defaults wxconfig=wx-config; prefix=/usr/local/bin; + include=-I/local/include; + include_dir=/local/include; optimise=1; debug=0; profile=0; @@ -210,48 +218,48 @@ shift; done; - echo -e "--with-wx-config\t\t\t\t$wxconfig"; - echo -e "--prefix\t\t\t\t\t$prefix"; - echo -e "--include-dir\t\t\t\t\t$include_dir"; + echo -e "checking for --with-wx-config\t\t\t$wxconfig"; + echo -e "checking for --prefix\t\t\t\t$prefix"; + echo -e "checking for --include-dir\t\t\t$include_dir"; - echo -e -n "--enable-optimise\t\t\t\t"; + echo -e -n "checking for --enable-optimise\t\t\t"; if test $optimise = 1; then - echo -e "yes"; + echo -e "${colour_yes}yes${colour_default}"; cppflags="$cppflags -O3" else - echo -e "no"; + echo -e "${colour_no}no${colour_default}"; fi; - echo -e -n "--enable-debug\t\t\t\t\t"; + echo -e -n "checking for --enable-debug\t\t\t"; if test $debug = 1; then - echo -e "yes"; + echo -e "${colour_yes}yes${colour_default}"; cppflags="$cppflags -g -ggdb -fno-inline" else - echo -e "no"; + echo -e "${colour_no}no${colour_default}"; fi; - echo -e -n "--enable-profile\t\t\t\t"; + echo -e -n "checking for --enable-profile\t\t\t"; if test $profile = 1; then - echo -e "yes"; + echo -e "${colour_yes}yes${colour_default}"; cppflags="$cppflags -pg" else - echo -e "no"; + echo -e "${colour_no}no${colour_default}"; fi; - echo -e -n "--has-patched-wxsizer\t\t\t\t"; + echo -e -n "checking for --has-patched-wxsizer\t\t"; if test $patch_sizer = 1; then - echo -e "yes"; + echo -e "${colour_yes}yes${colour_default}"; cppflags="$cppflags -D__HAVE_REMOVE_GROWABLE_COL__" else - echo -e "no"; - echo -e "\tWarning: Sidebar hiding code will be disabled."; + echo -e "${colour_no}no${colour_default}"; + echo -e "\t${colour_warning}Warning: Sidebar hiding code will be disabled.${colour_default}"; fi; - echo -e -n "--show-flags\t\t\t\t\t"; + echo -e -n "checking for --show-flags\t\t\t"; if test $show_flags = 1; then - echo -e "yes"; + echo -e "${colour_yes}yes${colour_default}"; else - echo -e "no"; + echo -e "${colour_no}no${colour_default}"; fi; } @@ -283,3 +291,5 @@ check_wxversion; check_ccache; gen_makefile; + +echo -e "configure complete. Now type \33[35;1mmake\33[0;2m and pray."; |
From: <ma...@us...> - 2003-12-12 08:37:51
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv5639/src Added Files: Makefile.am Removed Files: Makefile Makefile.b32 Makefile.win Log Message: configure script --- NEW FILE: Makefile.am --- PROGRAM = wxInterface # Colours DEFAULTCOLOR =\33[0;22m ACTIONCOLOR = \33[0;2m ATTENTIONCOLOR=\33[31;22m FAILEDCOLOR = WARNINGCOLOR =\33[33;22m NOTICEGCOLOR =\33[33;2m WELLCOLOR =\33[32;22m OUTPUTCOLOR =\33[35;1m INPUTCOLOR =\33[34;1m FLAGCOLOR =\33[37;1m WXINTERFACE_OBJECTS = ColorFrameCtrl.o \ DownloadListCtrl.o \ GUISettingsDlg.o \ Images.o \ KnownListCtrl.o \ MainDlg.o \ MessagesWnd.o \ MListCtrl.o \ QueueListCtrl.o \ SBPanel.o \ SearchListCtrl.o \ SearchWnd.o \ ServerListCtrl.o \ ServerWnd.o \ SharedFilesListCtrl.o \ SharedFilesWnd.o \ StatisticsWnd.o \ StatisticsTreeCtrl.o \ SysTray.o \ TransferWnd.o \ UploadListCtrl.o \ wxInterface.o \ wxInterface_wdr.o \ $(RES) \ all: $(PROGRAM) .cpp.o : @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_CPP_FLAGS@: $(ATTENTIONCOLOR)" @if @CXX@ @CXX_FLAGS@ @CPP_FLAGS@ @INCLUDE@ -c -o $@ $<; then \ echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ else \ false; \ fi; .rc.res: @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR): $(ATTENTIONCOLOR)" @if @WINDRES@ -i $< -I rc -o $@ -O coff --include-dir=@INCLUDE@; then \ echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ else \ false; \ fi; wxInterface: $(WXINTERFACE_OBJECTS) @echo -e -n "$(ACTIONCOLOR)Linking $(INPUTCOLOR)$(WXINTERFACE_OBJECTS)" @echo -e -n "$(ACTIONCOLOR)to $(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_LINK_FLAGS@: " @echo -e -n "$(ATTENTIONCOLOR)" @if @CXX@ -o $(PROGRAM) $(WXINTERFACE_OBJECTS) @LIBS@; then \ echo -e "$(WELLCOLOR)ok."; \ echo -e -n "$(DEFAULTCOLOR)"; \ echo -e -n "$(WELLCOLOR)Successfully compiled "; \ echo -e -n "$(WARNINGCOLOR)$(BUILD)"; \ echo -e -n "$(OUTPUTCOLOR)$@$(WELLCOLOR) binary!\n"; \ echo -e "$(DEFAULTCOLOR)Now cd to src/ dir and type $(OUTPUTCOLOR)./$@$(DEFAULTCOLOR) to start the application."; \ else \ false; \ fi clean: @echo -e -n "Cleaning up..." @rm -f $(WXINTERFACE_OBJECTS) $(PROGRAM) $(PROGRAM).exe @echo -e "$(WELLCOLOR) ok.$(DEFAULTCOLOR)" distclean: @echo -e -n "Cleaning up..." @rm -f $(WXINTERFACE_OBJECTS) $(PROGRAM) $(PROGRAM).exe Makefile @echo -e "$(WELLCOLOR) ok.$(DEFAULTCOLOR)" --- Makefile DELETED --- --- Makefile.b32 DELETED --- --- Makefile.win DELETED --- |
From: <ma...@us...> - 2003-12-12 08:37:51
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv5639 Modified Files: Changelog Added Files: Makefile.am configure Log Message: configure script --- NEW FILE: Makefile.am --- all: @cd src && make all clean: @cd src && make clean distclean: @cd src && make distclean --- NEW FILE: configure --- ################################################################################ # This file is part of wxInterface. # # Copyright (C) 2003 Alo Sarv <ma...@us...> # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ################################################################################ #!/bin/sh ## # Checks for ccache (compiler cache) availability # function check_ccache() { echo -n -e "checking for ccache...\t\t\t\t"; if test -x /usr/local/bin/ccache; then ccache=/usr/local/bin/ccache; echo "yes"; elif test -x /usr/bin/ccache; then ccache=/usr/bin/ccache; echo "yes" elif test -x /local/bin/ccache; then ccache=/local/bin/ccache; echo "yes" elif test -x /bin/ccache; then ccache=/bin/ccache; echo "yes" else echo "no"; fi; } ## # Checks for wx-config in various standard locations and sets $wxconfig variable # to the location of it if found, or calls not_found() if can't find wx-config. # function check_wxconfig() { echo -n -e "checking for wx-config... \t\t\t"; if test -x $wxconfig; then wxconfig=$wxconfig; elif test -x /usr/local/bin/wx-config; then wxconfig=/usr/local/bin/wx-config; elif test -x /usr/bin/wx-config; then wxconfig=/usr/bin/wx-config; elif test -x /bin/wx-config; then wxconfig=/bin/wx-config; elif test -x /local/bin/wx-config; then wxconfig=/local/bin/wx-config; elif test -x /wx/dynamic/2.4.2/bin/wx-config; then wxconfig=/wx/dynamic/2.4.2/bin/wx-config; elif test -x /wx/dynamic/2.5.0/bin/wx-config; then wxconfig=/wx/dynamic/2.5.0/bin/wx-config; else echo "no"; not_found; fi; echo "yes"; } ## # Checks for wxWindows library version by parsing output of wx-config --version # and testing it against 2.4.0. Exists script with true if version is >= 2.4.0. # function check_wxversion() { echo -e -n "checking for wxWindows version >= 2.4.0...\t"; wxversion=`$wxconfig --version` wxversion_major=`echo $wxversion | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` wxversion_minor=`echo $wxversion | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` wxversion_patch=`echo $wxversion | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test $wxversion_major -ge 2 -a $wxversion_minor -ge 0; then echo "yes" \ "($wxversion_major.$wxversion_minor.$wxversion_patch)"; else echo "no"; wrong_version; fi; } ## # Outputs error message about wx-config not being found, and prints suggestions. # function not_found() { cat <<EOF wx-config was not found in standard locations. This means that either you do not have wxWindows library installed for your platform (wxGTK for Linux, wxMac for Mac OS, wxMSW for MS Windows), you are missing wxWindows developer package or you have installed wxWindows into non-standard location. In the latter case, rerun configure with --with-wx-config=/path/to/wx-config. EOF exit 1; } ## # Outputs error message about too old wxWindows library and exits with false. # function wrong_version() { cat<<EOF wxWindows library was found, but is too old for usage (v$wxversion_major.\ $wxversion_minor.$wxversion_patch). Please download latest version for your platform ( wxGTK for Linux, wxMac for Mac OS, wxMSW for MS Windows ) from http://www.wxwindows.org, install it and rerun configure. EOF exit 1; } ## # Generates Makefile from Makefile.am # gen_makefile() { if test $show_flags = 1; then print_cpp_flags=" with flags: `$wxconfig --cxxflags` $cppflags $include"; print_link_flags=" with flags: `$wxconfig --libs`"; fi; echo "creating Makefile"; cp -f Makefile.am Makefile; echo "creating src/Makefile"; echo "# Automatically generated by configure - from Makefile.am" \ "do not modify!" > src/Makefile; sed -e "\ s#@CXX@#$ccache `$wxconfig --cxx`#; \ s#@CXX_FLAGS@#`$wxconfig --cxxflags`#; \ s#@LIBS@#`$wxconfig --libs`#; \ s#@CPP_FLAGS@#$cppflags#; \ s#@INCLUDE@#$include#; \ s#@PRINT_CPP_FLAGS@#$print_cpp_flags#;\ s#@PRINT_LINK_FLAGS@#$print_link_flags#;\ " src/Makefile.am >> src/Makefile; } ## # Parses command-line options and sets variables as needed. # parse_cmdline() { # defaults wxconfig=wx-config; prefix=/usr/local/bin; optimise=1; debug=0; profile=0; show_flags=0; patch_sizer=0; while test $# -gt 0; do case $1 in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --help) print_help; ;; --with-wx-config=*) wxconfig=$optarg; ;; --prefix=*) prefix=$optarg; ;; --include-dir=*) include="$include -I$optarg"; include_dir="$include_dir $optarg" ;; --enable-optimise) optimise=1; ;; --disable-optimise) optimise=0; ;; --enable-debug) debug=1; ;; --disable-debug) debug=0; ;; --enable-profile) profile=1; ;; --disable-profile) profile=0; ;; --has-patched-wxsizer) patch_sizer=1; ;; --show-flags) show_flags=1; ;; --hide-flags) show_flags=0; ;; *) print_help; ;; esac; shift; done; echo -e "--with-wx-config\t\t\t\t$wxconfig"; echo -e "--prefix\t\t\t\t\t$prefix"; echo -e "--include-dir\t\t\t\t\t$include_dir"; echo -e -n "--enable-optimise\t\t\t\t"; if test $optimise = 1; then echo -e "yes"; cppflags="$cppflags -O3" else echo -e "no"; fi; echo -e -n "--enable-debug\t\t\t\t\t"; if test $debug = 1; then echo -e "yes"; cppflags="$cppflags -g -ggdb -fno-inline" else echo -e "no"; fi; echo -e -n "--enable-profile\t\t\t\t"; if test $profile = 1; then echo -e "yes"; cppflags="$cppflags -pg" else echo -e "no"; fi; echo -e -n "--has-patched-wxsizer\t\t\t\t"; if test $patch_sizer = 1; then echo -e "yes"; cppflags="$cppflags -D__HAVE_REMOVE_GROWABLE_COL__" else echo -e "no"; echo -e "\tWarning: Sidebar hiding code will be disabled."; fi; echo -e -n "--show-flags\t\t\t\t\t"; if test $show_flags = 1; then echo -e "yes"; else echo -e "no"; fi; } ## # Outputs a detailed help text on command-line options # print_help() { cat <<EOF Usage: --help Print this message and return to shell --with-wx-config=DIR Specify the location of wx-config script --enable-optimise Optimize code ( recommended for users) --enable-debug Enable debugging ( recommended for devs) --enable-profile Enable profiling ( recommended for devs) --prefix=DIR Install to directory specified by DIR --include-dir=DIR Additional include directives as needed --has-patched-wxsizer wxWindows is patched with flexgridsizer patch ( enables sidebar hiding code ) --show-flags Enable printing compilation/link flags EOF exit 0; } ## # Main script execution part. # parse_cmdline $@; check_wxconfig; check_wxversion; check_ccache; gen_makefile; Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- Changelog 8 Dec 2003 01:11:15 -0000 1.104 +++ Changelog 12 Dec 2003 08:37:48 -0000 1.105 @@ -21,6 +21,9 @@ # ALL ChangeLog entries end with a dot. # ############################################################################### +2003/13/12 Alo Sarv + * Configure script + 2003/12/08 Alo Sarv * Fixed frame size/position saving. * Fixed wierd behaviour reported by Avi if menubar/preferences are |
From: <bo...@us...> - 2003-12-11 02:57:23
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv30362 Modified Files: osdep.h Log Message: Added helper macro btoh32 (big endian to host) Index: osdep.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- osdep.h 21 Nov 2003 04:04:17 -0000 1.11 +++ osdep.h 11 Dec 2003 02:57:20 -0000 1.12 @@ -31,6 +31,12 @@ * little endian to big endian (Networt Byte Order) in lton32 and back to * little endian in ntohl. But that is the problem with unportable data * exchange formats as used in the ed2k network. + * + * n = network + * h = host + * + * l = little endian + * b = big endian */ #define ltoh32(x) ntohl(lton32(x)) #define lton32(little_endian) ( \ @@ -44,6 +50,8 @@ (((little_endian )&(u16)0xff)<< 8) \ |(((little_endian>> 8)&(u16)0xff) ) \ ) +#define btoh32(x) ntohl(x) + #ifdef MACOSX #include <sys/types.h> |
From: <bo...@us...> - 2003-12-11 02:56:52
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv30278 Modified Files: ParseClass.cpp Log Message: Fixed little endian / big endian conversion bug in method IncrementalReadNonArray and added conversion support in method IncrementalReadArray Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ParseClass.cpp 9 Dec 2003 00:16:29 -0000 1.12 +++ ParseClass.cpp 11 Dec 2003 02:56:49 -0000 1.13 @@ -430,6 +430,27 @@ buffer +=size*n; buffsize-=size*n; done +=size*n; + + switch (type->type_id) { + case WORD: + while (n--) { + *(u16*)(data+size*n )=ltoh16(*(u16*)(data+size*n )); + } + break; + + case DWORD: + while (n--) { + *(u32*)(data+size*n )=ltoh32(*(u32*)(data+size*n )); + } + break; + + case IPPORT: + while (n--) { + *(u32*)(data+size*n )=btoh32(*(u32*)(data+size*n )); + *(u16*)(data+size*n+4)=ltoh16(*(u16*)(data+size*n+4)); + } + break; + } } return done; @@ -552,7 +573,7 @@ case BYTE: scalar=true; * dataptr =val= * buffer ; break; case WORD: scalar=true; *(u16*) dataptr =val=ltoh16(*(u16*) buffer) ; break; case DWORD: scalar=true; *(u32*) dataptr =val=ltoh32(*(u32*) buffer) ; break; - case IPPORT: scalar=false; *(u32*) dataptr = lton32(*(u32*) buffer ); + case IPPORT: scalar=false; *(u32*) dataptr = btoh32(*(u32*) buffer ); *(u16*)(dataptr+4)= ltoh16(*(u16*)(buffer+4)); break; default: scalar=false; |
From: <bo...@us...> - 2003-12-09 17:53:15
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv11107 Modified Files: main-c.c Log Message: Fixed bug (missing #include osdep.h). Index: main-c.c =================================================================== RCS file: /cvsroot/sharedaemon/core/src/main-c.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- main-c.c 26 Nov 2003 02:05:02 -0000 1.1 +++ main-c.c 9 Dec 2003 17:53:12 -0000 1.2 @@ -20,15 +20,13 @@ #include "main-c.h" +#include "osdep.h" + #include <dirent.h> -//#include <errno.h> -//#include <fcntl.h> -//#include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> -//#include <unistd.h> #ifndef S_IFMT # define S_IFMT 0170000 /* These bits determine file type. */ |
From: <bo...@us...> - 2003-12-09 00:16:34
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv4491 Modified Files: ParseClass.cpp ParseClass.h parse-ed2k.c test.cpp Log Message: Initial write support for ParseClass Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ParseClass.cpp 26 Nov 2003 02:03:36 -0000 1.11 +++ ParseClass.cpp 9 Dec 2003 00:16:29 -0000 1.12 @@ -631,6 +631,10 @@ return true; } +bool ParseClass::Read(const Ed2kPacket & p) { + return Read(p.GetPtr(),p.GetSize()); +} + bool ParseClass::Read(FILE * file) { /* * ISO/IEC 9899:1999 (E) §7.19.9.2(3) @@ -684,6 +688,88 @@ rc=Read(file); fclose(file); + + return rc; +} + +bool ParseClass::Write(u8 * * buffer,size_t * buffsize) const { + +} + +bool ParseClass::Write(Ed2kPacket & p,u8 protocol,u8 opcode) const { + u8 * buffer; + size_t buffsize; + + if (!Write(&buffer,&buffsize)) { + return false; + } + + p.SetData(protocol,opcode,buffsize,buffer); + + delete buffer; + + return true; +} + +bool ParseClass::Write(FILE * file) const { + u8 * buffer; + size_t buffsize; + + if (!Write(&buffer,&buffsize)) { + return false; + } + + if (fwrite(buffer,1,buffsize,file) != buffsize) { + return false; + } + + delete buffer; + + return true; +} + +bool ParseClass::Write(const char * filename) const { + bool rc; + FILE * file; + char * othername; + int sl; + + sl=strlen(filename); + othername=new char[sl+5]; + strcpy(othername,filename); + + strcpy(othername+sl,".new"); + file=fopen(othername,"wb"); + if (!file) { + delete othername; + return false; + } + + rc=Write(file); + + fclose(file); + + if (rc) { + strcpy(othername+sl,".bak"); + unlink(othername); + if (rename(filename,othername)) { + if (errno!=ENOENT) { + delete othername; + return false; + } + } + strcpy(othername+sl,".new"); + if (rename(othername,filename)) { + if (errno!=ENOENT) { + delete othername; + return false; + } + } + } else { + unlink(othername); + } + + delete othername; return rc; } Index: ParseClass.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ParseClass.h 26 Nov 2003 01:22:56 -0000 1.10 +++ ParseClass.h 9 Dec 2003 00:16:29 -0000 1.11 @@ -38,6 +38,7 @@ #include "util.h" #include "mprintf.h" #include "parse-ed2k.h" +#include "Ed2kPacket.h" #include <cassert> #include <cstdarg> @@ -59,21 +60,21 @@ * Special care must be taken on BYTE and CHAR as one cannot distinquished * between them. Thus GetTypeID(BYTE) == GetTypeID(CHAR)! */ -template <class T> int GetTypeID( T &t ) { generate=error+on+invalid+type; } -inline int GetTypeID( char &t ) { return CHAR; } -inline int GetTypeID( unsigned char &t ) { return BYTE; } -inline int GetTypeID( signed char &t ) { return BYTE; } -inline int GetTypeID( short &t ) { return WORD; } -inline int GetTypeID( unsigned short &t ) { return WORD; } -inline int GetTypeID( long &t ) { return DWORD; } -inline int GetTypeID( unsigned long &t ) { return DWORD; } -inline int GetTypeID( int &t ) { return DWORD; } -inline int GetTypeID( unsigned int &t ) { return DWORD; } -inline int GetTypeID( range &t ) { return RANGE; } -inline int GetTypeID( ipport &t ) { return IPPORT; } -inline int GetTypeID( hash &t ) { return HASH; } -inline int GetTypeID( tag &t ) { return TAG; } -inline int GetTypeID( bitmap &t ) { return BITMAP; } +template <class T> int GetTypeID(const T &t ) { generate=error+on+invalid+type; } +inline int GetTypeID(const char &t ) { return CHAR; } +inline int GetTypeID(const unsigned char &t ) { return BYTE; } +inline int GetTypeID(const signed char &t ) { return BYTE; } +inline int GetTypeID(const short &t ) { return WORD; } +inline int GetTypeID(const unsigned short &t ) { return WORD; } +inline int GetTypeID(const long &t ) { return DWORD; } +inline int GetTypeID(const unsigned long &t ) { return DWORD; } +inline int GetTypeID(const int &t ) { return DWORD; } +inline int GetTypeID(const unsigned int &t ) { return DWORD; } +inline int GetTypeID(const range &t ) { return RANGE; } +inline int GetTypeID(const ipport &t ) { return IPPORT; } +inline int GetTypeID(const hash &t ) { return HASH; } +inline int GetTypeID(const tag &t ) { return TAG; } +inline int GetTypeID(const bitmap &t ) { return BITMAP; } #define ISSTRUCT(x) true #define ISARRAY(x) true @@ -224,20 +225,42 @@ size_t IncrementalReadNonArray(const u8 * buffer,size_t buffsize); size_t IncrementalReadArray(const u8 * buffer,size_t buffsize); - template <class D,class S> void Cast(D & dst,const S & src) const { + template <class D,class S> void GetCast(D & dst,const S & src) const { fprintf(stderr,"%s:%s:%i: FATAL: Cannot cast types.\n" ,__FILE__,__FUNCTION__,__LINE__ ); abort(); } - void Cast(unsigned long & dst,const u16 & src) const { dst=src; } - void Cast(unsigned int & dst,const u16 & src) const { dst=src; } - void Cast(unsigned short & dst,const u16 & src) const { dst=src; } + template <class S,class D> void SetCast(const S & src,D & dst) const { + fprintf(stderr,"%s:%s:%i: FATAL: Cannot cast types.\n" + ,__FILE__,__FUNCTION__,__LINE__ + ); + abort(); + } - void Cast(unsigned long & dst,const u8 & src) const { dst=src; } - void Cast(unsigned int & dst,const u8 & src) const { dst=src; } - void Cast(unsigned short & dst,const u8 & src) const { dst=src; } + void GetCast(unsigned long & dst,const u16 & src) const { dst=src; } + void GetCast(unsigned int & dst,const u16 & src) const { dst=src; } + void GetCast(unsigned short & dst,const u16 & src) const { dst=src; } + + void GetCast(unsigned long & dst,const u8 & src) const { dst=src; } + void GetCast(unsigned int & dst,const u8 & src) const { dst=src; } + void GetCast(unsigned short & dst,const u8 & src) const { dst=src; } + + void SetCast(const unsigned long & src,u32 & dst) const { dst=src; } + void SetCast(const unsigned int & src,u32 & dst) const { dst=src; } + void SetCast(const unsigned short & src,u32 & dst) const { dst=src; } + void SetCast(const unsigned char & src,u32 & dst) const { dst=src; } + +/* + void SetCast(const unsigned long & src,u16 & dst) const { dst=src; } + void SetCast(const unsigned int & src,u16 & dst) const { dst=src; } + void SetCast(const unsigned short & src,u16 & dst) const { dst=src; } + + void SetCast(const unsigned long & src,u8 & dst) const { dst=src; } + void SetCast(const unsigned int & src,u8 & dst) const { dst=src; } + void SetCast(const unsigned short & src,u8 & dst) const { dst=src; } +*/ /* inline int GetTypeID( char &t ) { return CHAR; } @@ -285,22 +308,21 @@ if (!struc && !array) { void * ptr=data+size*index+ps->offset; + int tid=GetTypeID(var); - if (GetTypeID(var) == ps->type_id) { + if (tid == ps->type_id) { var=*(T*)ptr; } else { - int tid=GetTypeID(var); - switch (ps->type_id) { case WORD: if (tid==DWORD) { - Cast(var,*(u16*)ptr); + GetCast(var,*(u16*)ptr); return; } break; case BYTE: if (tid==DWORD || tid==WORD) { - Cast(var,*(u8 *)ptr); + GetCast(var,*(u8 *)ptr); return; } break; @@ -360,21 +382,74 @@ } if (!struc && !array) { - *(T*)(data+size*index+ps->offset)=var; - ParseClass * PC=*(ParseClass**) - (data+size*(index+1)-sizeof(ParseClass*)); - PC+=ps->first_referer; - i=ps->num_referer; - do { - (*(PC++)).Resize(var); - } while (--i); + void * ptr; + int tid; + u32 val; + bool resize; + + ptr=data+size*index+ps->offset; + tid=GetTypeID(var); + resize=false; + + if (tid == ps->type_id) { + *(T*)ptr=var; + + if (tid == DWORD || tid == WORD || tid == BYTE) { + resize = true; + SetCast(var,val); + } + } else { + switch (ps->type_id) { + case WORD: + if (tid==DWORD) { + SetCast(var,val); + *(u16*)ptr=*(u16*)&val; + resize = true; + } + break; + case BYTE: + if (tid==DWORD || tid==WORD) { + SetCast(var,val); + *(u8*)ptr=*(u8*)&val; + resize = true; + } + break; + default: + /* nothing to do here */ + break; + } + + if (!resize) { + fprintf(stderr, + "%s:%s:%i: FATAL: Type doesn " + "not match. %s was expected " + "but %s was given\n" + ,__FILE__,__FUNCTION__,__LINE__ + ,::type[ps->type_id].type_name + ,tid>=0 + ?::type[tid].type_name + :"<special>" + ); + abort(); + } + } + + if (resize) { + ParseClass * * PC=FirstParseClassPointer(index); + + PC+=ps->first_referer; + i=ps->num_referer; + while (i--) { + (*(PC++))->Resize(val); + } + } } else { - ParseClass * PC=*(ParseClass**) - (data+size*(index+1)-sizeof(ParseClass*)); + ParseClass * * PC=FirstParseClassPointer(index); + if (struc) { - PC[ps->referer_id].Set(var,next_index,subexpr); + PC[ps->referer_id]->Set(var,next_index,subexpr); } else { - *(T*)(PC->data+PC->size*next_index)=var; + *(T*)(PC[ps->referer_id]->data+PC[ps->referer_id]->size*next_index)=var; /* * An array MUST NOT be used as subscript, so * we don't need to take care about that here. @@ -418,11 +493,13 @@ bool Read(const u8 * buffer,size_t buffsize); bool Read(FILE * file); bool Read(const char * filename); + bool Read(const Ed2kPacket & p); // *buffsize=(size_t)-1 means error bool Write(u8 * * buffer,size_t * buffsize) const; bool Write(FILE * file) const; bool Write(const char * filename) const; + bool Write(Ed2kPacket & p,u8 protocol,u8 opcode) const; /* struct bitmap Bitmap(const char * varname_fmt,...) PRINTF_FORMAT; Index: parse-ed2k.c =================================================================== RCS file: /cvsroot/sharedaemon/core/src/parse-ed2k.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- parse-ed2k.c 26 Nov 2003 01:22:56 -0000 1.14 +++ parse-ed2k.c 9 Dec 2003 00:16:29 -0000 1.15 @@ -72,6 +72,7 @@ int ClientClient:1; u8 command; char * name; + char * altname; struct parsestruct * element; char * format; }; @@ -95,15 +96,15 @@ // | | | | | | +-- Client <-> Client // Client <-> Server #define LOGINREQUEST 0x01 // mlDonkey adds a DWORD with content: 'MLDK' // <DWORD>tagcount<TAG>tag[tagcount] // <BYTE>magic=0x10 - { 1,0,0,0,0,0,0,PROT_NAME(LOGINREQUEST) ,NULL,"<HASH>user_hash<IPPORT>client_address=0,0<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address<DWORD>*software_id=1262767181" }, + { 1,0,0,0,0,1,0,PROT_NAME(LOGINREQUEST) ,"cse301",NULL,"<HASH>user_hash<IPPORT>client_address=0,0<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address<DWORD>*software_id=1262767181" }, #define REJECT 0x05 - { 1,0,0,0,0,0,0,PROT_NAME(REJECT) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(REJECT) ,"cse305",NULL,"" }, #define GETSERVERLIST 0x14 - { 1,0,0,0,0,0,0,PROT_NAME(GETSERVERLIST) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(GETSERVERLIST) ,"cse314",NULL,"" }, #define OFFERFILES 0x15 - { 1,0,0,0,0,0,0,PROT_NAME(OFFERFILES) ,NULL,"<DWORD>file_count{<HASH>hash<IPPORT>source<DWORD>tagcount<TAG>tag[tagcount]}file[file_count]" }, + { 1,0,0,0,0,0,0,PROT_NAME(OFFERFILES) ,"cse315",NULL,"<DWORD>filecount{<HASH>hash<IPPORT>source<DWORD>tagcount<TAG>tag[tagcount]}file[filecount]" }, #define SEARCHREQUEST 0x16 -// { 1,0,0,0,0,0,0,PROT_NAME(SEARCHREQUEST) ,NULL,"<Query_Tree>query" }, +// { 1,0,0,0,0,0,0,PROT_NAME(SEARCHREQUEST) ,"cse316",NULL,"<Query_Tree>query" }, /* Local search for "Bodo sucht für tcpdump" @@ -130,188 +131,188 @@ */ #define DISCONNECT 0x18 // (not verified) - { 1,0,0,0,0,0,0,PROT_NAME(DISCONNECT) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(DISCONNECT) ,"cse318",NULL,"" }, #define GETSOURCES 0x19 - { 1,0,0,0,0,0,0,PROT_NAME(GETSOURCES) ,NULL,"<HASH>file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(GETSOURCES) ,"cse319",NULL,"<HASH>file_hash" }, #define SEARCH_USER 0x1A -// { 1,0,0,0,0,0,0,PROT_NAME(SEARCH_USER) ,NULL,"<Query_Tree>query" }, +// { 1,0,0,0,0,0,0,PROT_NAME(SEARCH_USER) ,"cse31a",NULL,"<Query_Tree>query" }, // Maybe there is a 0x1b too // CONFORMING TO "eDonkey-protocol-0.6.1" #define CALLBACKREQUEST 0x1C // <ID 4> - { 1,0,0,0,0,0,0,PROT_NAME(CALLBACKREQUEST) ,NULL,"<DWORD>LowID_client_ip" }, + { 1,0,0,0,0,0,0,PROT_NAME(CALLBACKREQUEST) ,"cse31c",NULL,"<DWORD>LowID_client_ip" }, // Maybe there is a 0x20 too // CONFORMING TO "eDonkey-protocol-0.6.1" : Exception in Connection::doTask 25 for 16.39 #define QUERY_MORE_RESULT 0x21 - { 1,0,0,0,0,0,0,PROT_NAME(QUERY_MORE_RESULT) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(QUERY_MORE_RESULT) ,"cse321",NULL,"" }, #define SERVERLIST 0x32 // Server -> Client - { 1,0,0,0,0,0,0,PROT_NAME(SERVERLIST) ,NULL,"<BYTE>server_count<IPPORT>server[server_count]" }, + { 1,0,0,0,0,0,0,PROT_NAME(SERVERLIST) ,"cse332",NULL,"<BYTE>server_count<IPPORT>server[server_count]" }, #define SEARCHRESULT 0x33 - { 1,0,0,0,0,0,0,PROT_NAME(SEARCHRESULT) ,NULL,"<DWORD>num_results{<HASH>hash<IPPORT>ipport<DWORD>tag_count<TAG>tag[tag_count]}user[num_results]<DWORD>unknown1<DWORD>unknown2" }, + { 1,0,0,0,0,0,0,PROT_NAME(SEARCHRESULT) ,"cse333",NULL,"<DWORD>num_results{<HASH>hash<IPPORT>ipport<DWORD>tag_count<TAG>tag[tag_count]}user[num_results]<DWORD>unknown1<DWORD>unknown2" }, #define SERVERSTATUS 0x34 - { 1,0,0,0,0,0,0,PROT_NAME(SERVERSTATUS) ,NULL,"<DWORD>user_count<DWORD>file_count" }, + { 1,0,0,0,0,0,0,PROT_NAME(SERVERSTATUS) ,"cse334",NULL,"<DWORD>user_count<DWORD>file_count" }, #define CALLBACKREQUESTED 0x35 - { 1,0,0,0,0,0,0,PROT_NAME(CALLBACKREQUESTED) ,NULL,"<IPPORT>HighID_client_ip" }, + { 1,0,0,0,0,0,0,PROT_NAME(CALLBACKREQUESTED) ,"cse335",NULL,"<IPPORT>HighID_client_ip" }, #define CALLBACK_FAIL 0x36 - { 1,0,0,0,0,0,0,PROT_NAME(CALLBACK_FAIL) ,NULL,"<DWORD>client_id" }, + { 1,0,0,0,0,0,0,PROT_NAME(CALLBACK_FAIL) ,"cse336",NULL,"<DWORD>client_id" }, #define SERVERMESSAGE 0x38 - { 1,0,0,0,0,0,0,PROT_NAME(SERVERMESSAGE) ,NULL,"<WORD>message_len<CHAR>message[message_len]" }, + { 1,0,0,0,0,0,0,PROT_NAME(SERVERMESSAGE) ,"cse338",NULL,"<WORD>message_len<CHAR>message[message_len]" }, #define IDCHANGE 0x40 - { 1,0,0,0,0,0,0,PROT_NAME(IDCHANGE) ,NULL,"<DWORD>new_id" }, + { 1,0,0,0,0,0,0,PROT_NAME(IDCHANGE) ,"cse340",NULL,"<DWORD>new_id" }, #define SERVERIDENT 0x41 - { 1,0,0,0,0,0,0,PROT_NAME(SERVERIDENT) ,NULL,"<HASH>server_hash<IPPORT>server_address<DWORD>tag_count<TAG>tag[tag_count]" }, + { 1,0,0,0,0,0,0,PROT_NAME(SERVERIDENT) ,"cse341",NULL,"<HASH>server_hash<IPPORT>server_address<DWORD>tag_count<TAG>tag[tag_count]" }, #define FOUNDSOURCES 0x42 - { 1,0,0,0,0,0,0,PROT_NAME(FOUNDSOURCES) ,NULL,"<HASH>file_hash<BYTE>source_count<IPPORT>source_address[source_count]" }, + { 1,0,0,0,0,0,0,PROT_NAME(FOUNDSOURCES) ,"cse342",NULL,"<HASH>file_hash<BYTE>source_count<IPPORT>source_address[source_count]" }, #define USERS_LIST 0x43 - { 1,0,0,0,0,0,0,PROT_NAME(USERS_LIST) ,NULL,"<DWORD>user_count{<HASH>hash<IPPORT>address<TAG>name}user[user_count]" }, + { 1,0,0,0,0,0,0,PROT_NAME(USERS_LIST) ,"cse343",NULL,"<DWORD>user_count{<HASH>hash<IPPORT>address<TAG>name}user[user_count]" }, #define QUERY_CHATS 0x1D // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(QUERY_CHATS) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(QUERY_CHATS) ,"cse31d",NULL,"DEPRECATED" }, #define CHAT_MESSAGE 0x1E // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_MESSAGE) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_MESSAGE) ,"cse31e",NULL,"DEPRECATED" }, #define JOIN_ROOM 0x1F // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(JOIN_ROOM) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(JOIN_ROOM) ,"cse31f",NULL,"DEPRECATED" }, #define CHAT_ROOM_REQUEST 0x39 // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_ROOM_REQUEST) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_ROOM_REQUEST) ,"cse339",NULL,"DEPRECATED" }, #define CHAT_BROADCAST 0x3A // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_BROADCAST) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_BROADCAST) ,"cse33a",NULL,"DEPRECATED" }, #define CHAT_USER_JOIN 0x3B // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_USER_JOIN) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_USER_JOIN) ,"cse33b",NULL,"DEPRECATED" }, #define CHAT_USER_LEAVE 0x3C // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_USER_LEAVE) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_USER_LEAVE) ,"cse33c",NULL,"DEPRECATED" }, #define CHAT_USER 0x3D // (deprecated not supported by server any longer) -// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_USER) ,NULL,"DEPRECATED" }, +// { 1,0,0,0,0,0,0,PROT_NAME(CHAT_USER) ,"cse33d",NULL,"DEPRECATED" }, // client <-> server [UDP] #define GLOBSERVSTATREQ 0x96 - { 1,0,0,0,0,0,0,PROT_NAME(GLOBSERVSTATREQ) ,NULL,"<WORD>unknown1<WORD>unknown2" }, + { 1,0,0,0,0,0,0,PROT_NAME(GLOBSERVSTATREQ) ,"cse396",NULL,"<WORD>unknown1<WORD>unknown2" }, // if unknown2==0xaa,0x5a, The respond contains max_users, else not. -// { 1,0,0,0,0,0,0,PROT_NAME(GLOBSERVSTATRES) ,NULL,"<DWORD>user_count<DWORD>file_count" }, +// { 1,0,0,0,0,0,0,PROT_NAME(GLOBSERVSTATRES) ,"cse396",NULL,"<DWORD>user_count<DWORD>file_count" }, #define GLOBSERVSTATRES 0x97 - { 1,0,0,0,0,0,0,PROT_NAME(GLOBSERVSTATRES) ,NULL,"<WORD>unknown1<WORD>unknown2<DWORD>user_count<DWORD>file_count<DWORD>*max_users" }, + { 1,0,0,0,0,0,0,PROT_NAME(GLOBSERVSTATRES) ,"cse397",NULL,"<WORD>unknown1<WORD>unknown2<DWORD>user_count<DWORD>file_count<DWORD>*max_users" }, #define GLOBSEARCHREQUEST 0x98 -// { 1,0,0,0,0,0,0,PROT_NAME(GLOBSEARCHREQUEST) ,NULL,"<Search query>" }, +// { 1,0,0,0,0,0,0,PROT_NAME(GLOBSEARCHREQUEST) ,"cse398",NULL,"<Search query>" }, #define GLOBSEARCHRESULT 0x99 - { 1,0,0,0,0,0,0,PROT_NAME(GLOBSEARCHRESULT) ,NULL,"<HASH>hash<IPPORT>dummy<DWORD>tag_count<TAG>tag[tag_count]" }, + { 1,0,0,0,0,0,0,PROT_NAME(GLOBSEARCHRESULT) ,"cse399",NULL,"<HASH>hash<IPPORT>dummy<DWORD>tag_count<TAG>tag[tag_count]" }, #define GLOBGETSOURCES 0x9A - { 1,0,0,0,0,0,0,PROT_NAME(GLOBGETSOURCES) ,NULL,"<HASH>file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(GLOBGETSOURCES) ,"cse39a",NULL,"<HASH>file_hash" }, #define GLOBFOUNDSORUCES 0x9B - { 1,0,0,0,0,0,0,PROT_NAME(GLOBFOUNDSORUCES) ,NULL,"<HASH>file_hash<BYTE>num_peers<IPPORT>peer[num_peers]" }, + { 1,0,0,0,0,0,0,PROT_NAME(GLOBFOUNDSORUCES) ,"cse39b",NULL,"<HASH>file_hash<BYTE>num_peers<IPPORT>peer[num_peers]" }, #define GLOBCALLBACKREQ 0x9C - { 1,0,0,0,0,0,0,PROT_NAME(GLOBCALLBACKREQ) ,NULL,"<DWORD>LowID_client_id" }, -#define GLOBCALLBACKFAILED 0x9e // CONFORMING TO "eDonkey-protocol-0.6.1" - { 1,0,0,0,0,0,0,PROT_NAME(GLOBCALLBACKFAILED) ,NULL,"<DWORD>LowID_client_id" }, + { 1,0,0,0,0,0,0,PROT_NAME(GLOBCALLBACKREQ) ,"cse39c",NULL,"<DWORD>LowID_client_id" }, +#define GLOBCALLBACKFAILED 0x9E // CONFORMING TO "eDonkey-protocol-0.6.1" + { 1,0,0,0,0,0,0,PROT_NAME(GLOBCALLBACKFAILED) ,"cse39e",NULL,"<DWORD>LowID_client_id" }, // Maybe there is a 0xA0 too // CONFORMING TO "eDonkey-protocol-0.6.1" : Exception in Connection::doTask 25 for 16.39 -#define UDP_SERVERLIST 0xa1 // CONFORMING TO "eDonkey-protocol-0.6.1" -// { 1,0,0,0,0,0,0,PROT_NAME(UDP_SERVERLIST) ,NULL,"<Address list>" }, +#define UDP_SERVERLIST 0xA1 // CONFORMING TO "eDonkey-protocol-0.6.1" +// { 1,0,0,0,0,0,0,PROT_NAME(UDP_SERVERLIST) ,"cse3a1",NULL,"<Address list>" }, #define UNKNOWN1 0xA2 - { 1,0,0,0,0,0,0,PROT_NAME(UNKNOWN1) ,NULL,"" }, -#define UDP_SERVERINFO 0xa3 // CONFORMING TO "eDonkey-protocol-0.6.1" -// { 1,0,0,0,0,0,0,PROT_NAME(UDP_SERVERLIST) ,NULL,"<String>name<String>description" }, + { 1,0,0,0,0,0,0,PROT_NAME(UNKNOWN1) ,"cse3a2",NULL,"" }, +#define UDP_SERVERINFO 0xA3 // CONFORMING TO "eDonkey-protocol-0.6.1" +// { 1,0,0,0,0,0,0,PROT_NAME(UDP_SERVERLIST) ,"cse3a3",NULL,"<String>name<String>description" }, #define UNKNOWN2 0xA4 - { 1,0,0,0,0,0,0,PROT_NAME(UNKNOWN2) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(UNKNOWN2) ,"cse3a4",NULL,"" }, // client <-> client #define HELLO 0x01 - { 1,0,0,0,0,0,0,PROT_NAME(HELLO) ,NULL,"<BYTE>magic=0x10<HASH>user_hash<IPPORT>address<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address" }, + { 1,0,0,0,0,0,1,PROT_NAME(HELLO) ,"cce301",NULL,"<BYTE>magic=0x10<HASH>user_hash<IPPORT>address<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address" }, #define SENDINGPART 0x46 - { 1,0,0,0,0,0,0,PROT_NAME(SENDINGPART) ,NULL,"<HASH>file_hash<RANGE>range<BYTE>data[range]" }, + { 1,0,0,0,0,0,0,PROT_NAME(SENDINGPART) ,"cce346",NULL,"<HASH>file_hash<RANGE>range<BYTE>data[range]" }, #define REQUESTPARTS 0x47 // "<HASH>file_hash<DWORD>start[3]<DWORD>end[3]" - { 1,0,0,0,0,0,0,PROT_NAME(REQUESTPARTS) ,NULL,"<HASH>file_hash<DWORD>part_1_start<DWORD>part_2_start<DWORD>part_3_start<DWORD>part_1_end<DWORD>part_2_end<DWORD>part_3_end" }, // <HASH>file_hash<DWORD>start[3]<DWORD>end[3] + { 1,0,0,0,0,0,0,PROT_NAME(REQUESTPARTS) ,"cce347",NULL,"<HASH>file_hash<DWORD>part_1_start<DWORD>part_2_start<DWORD>part_3_start<DWORD>part_1_end<DWORD>part_2_end<DWORD>part_3_end" }, // <HASH>file_hash<DWORD>start[3]<DWORD>end[3] #define FILEREQANSNOFIL 0x48 - { 1,0,0,0,0,0,0,PROT_NAME(FILEREQANSNOFIL) ,NULL,"<HASH>file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(FILEREQANSNOFIL) ,"cce348",NULL,"<HASH>file_hash" }, #define END_OF_DOWNLOAD 0x49 - { 1,0,0,0,0,0,0,PROT_NAME(END_OF_DOWNLOAD) ,NULL,"<HASH>file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(END_OF_DOWNLOAD) ,"cce349",NULL,"<HASH>file_hash" }, #define ASKSHAREDFILES 0x4A - { 1,0,0,0,0,0,0,PROT_NAME(ASKSHAREDFILES) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(ASKSHAREDFILES) ,"cce34a",NULL,"" }, #define ASKSHAREDFILESANSWER 0x4B // ? "<DWORD>file_count{<HASH>file<TAG>name}file[file_count]" }, - { 1,0,0,0,0,0,0,PROT_NAME(ASKSHAREDFILESANSWER) ,NULL,"<DWORD>file_count{<IPPORT>address<TAG>name}file[file_count]" }, -#define HELLOANSWER 0x4c - { 1,0,0,0,0,0,0,PROT_NAME(HELLOANSWER) ,NULL,"<HASH>user_hash<IPPORT>user<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server" }, + { 1,0,0,0,0,0,0,PROT_NAME(ASKSHAREDFILESANSWER) ,"cce34b",NULL,"<DWORD>file_count{<IPPORT>address<TAG>name}file[file_count]" }, +#define HELLOANSWER 0x4C + { 1,0,0,0,0,0,0,PROT_NAME(HELLOANSWER) ,"cce34c",NULL,"<HASH>user_hash<IPPORT>user<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server" }, #define CHANGE_CLIENT_ID 0x4D - { 1,0,0,0,0,0,0,PROT_NAME(CHANGE_CLIENT_ID) ,NULL,"<DWORD>old_id<DWORD>new_id" }, + { 1,0,0,0,0,0,0,PROT_NAME(CHANGE_CLIENT_ID) ,"cce34d",NULL,"<DWORD>old_id<DWORD>new_id" }, #define MESSAGE 0x4E - { 1,0,0,0,0,0,0,PROT_NAME(MESSAGE) ,NULL,"<WORD>message_len<CHAR>message[message_len]" }, -#define SETREQFILEID 0x4f - { 1,0,0,0,0,0,0,PROT_NAME(SETREQFILEID) ,NULL,"<HASH>file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(MESSAGE) ,"cce34e",NULL,"<WORD>message_len<CHAR>message[message_len]" }, +#define SETREQFILEID 0x4F + { 1,0,0,0,0,0,0,PROT_NAME(SETREQFILEID) ,"cce34f",NULL,"<HASH>file_hash" }, #define FILESTATUS 0x50 - { 1,0,0,0,0,0,0,PROT_NAME(FILESTATUS) ,NULL,"<HASH>file_hash<BITMAP>chunks" }, + { 1,0,0,0,0,0,0,PROT_NAME(FILESTATUS) ,"cce350",NULL,"<HASH>file_hash<BITMAP>chunks" }, #define HASHSETREQUEST 0x51 - { 1,0,0,0,0,0,0,PROT_NAME(HASHSETREQUEST) ,NULL,"<HASH>file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(HASHSETREQUEST) ,"cce351",NULL,"<HASH>file_hash" }, #define HASHSETANSWER 0x52 - { 1,0,0,0,0,0,0,PROT_NAME(HASHSETANSWER) ,NULL,"<HASH>file_hash<WORD>chunk_count<HASH>chunk_hash[chunk_count]" }, + { 1,0,0,0,0,0,0,PROT_NAME(HASHSETANSWER) ,"cce352",NULL,"<HASH>file_hash<WORD>chunk_count<HASH>chunk_hash[chunk_count]" }, // Maybe there is a 0x53 too // CONFORMING TO "eDonkey-protocol-0.6.1" #define STARTUPLOADREQ 0x54 // The file_hash seems to be optional - { 1,0,0,0,0,0,0,PROT_NAME(STARTUPLOADREQ) ,NULL,"<HASH>*file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(STARTUPLOADREQ) ,"cce354",NULL,"<HASH>*file_hash" }, #define ACCEPTUPLOADREQ 0x55 - { 1,0,0,0,0,0,0,PROT_NAME(ACCEPTUPLOADREQ) ,NULL,"<EMPTY>" }, + { 1,0,0,0,0,0,0,PROT_NAME(ACCEPTUPLOADREQ) ,"cce355",NULL,"<EMPTY>" }, #define CANCELTRANSFER 0x56 - { 1,0,0,0,0,0,0,PROT_NAME(CANCELTRANSFER) ,NULL,"<EMPTY>" }, + { 1,0,0,0,0,0,0,PROT_NAME(CANCELTRANSFER) ,"cce356",NULL,"<EMPTY>" }, #define OUTOFPARTREQS 0x57 - { 1,0,0,0,0,0,0,PROT_NAME(OUTOFPARTREQS) ,NULL,"<EMPTY>" }, + { 1,0,0,0,0,0,0,PROT_NAME(OUTOFPARTREQS) ,"cce357",NULL,"<EMPTY>" }, #define FILEREQUEST 0x58 - { 1,0,0,0,0,0,0,PROT_NAME(FILEREQUEST) ,NULL,"<HASH>file_hash<BITMAP>*chunks" }, + { 1,0,0,0,0,0,0,PROT_NAME(FILEREQUEST) ,"cce358",NULL,"<HASH>file_hash<BITMAP>*chunks" }, #define FILEREQANSWER 0x59 - { 1,0,0,0,0,0,0,PROT_NAME(FILEREQANSWER) ,NULL,"<HASH>file_hash<WORD>filename_len<CHAR>filename[filename_len]" }, + { 1,0,0,0,0,0,0,PROT_NAME(FILEREQANSWER) ,"cce359",NULL,"<HASH>file_hash<WORD>filename_len<CHAR>filename[filename_len]" }, #define CHANGE_SLOT 0x5B // The writers of "eDonkey-protocol-0.6.1" are not sure about this... - { 1,0,0,0,0,0,0,PROT_NAME(CHANGE_SLOT) ,NULL,"<HASH>file_hash" }, + { 1,0,0,0,0,0,0,PROT_NAME(CHANGE_SLOT) ,"cce35b",NULL,"<HASH>file_hash" }, #define QUEUERANK 0x5C // (original comment: slot index of the request) - { 1,0,0,0,0,0,0,PROT_NAME(QUEUERANK) ,NULL,"<DWORD>rank" }, + { 1,0,0,0,0,0,0,PROT_NAME(QUEUERANK) ,"cce35c",NULL,"<DWORD>rank" }, // Client -> Client, CONFORMING TO "eDonkey-protocol-0.6.1" #define GETSHAREDDIRS 0x5d // Request shared directories - { 1,0,0,0,0,0,0,PROT_NAME(GETSHAREDDIRS) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(GETSHAREDDIRS) ,"cce35d",NULL,"" }, #define GETSHAREDFILES4DIR 0x5e // Request shared files from directory -// { 1,0,0,0,0,0,0,PROT_NAME(GETSHAREDFILES4DIR) ,NULL,"<Directory>" }, +// { 1,0,0,0,0,0,0,PROT_NAME(GETSHAREDFILES4DIR) ,"cce35e",NULL,"<Directory>" }, #define ANSWERSHAREDDIRS 0x5f -// { 1,0,0,0,0,0,0,PROT_NAME(ANSWERSHAREDDIRS) ,NULL,"<Directory list>" }, +// { 1,0,0,0,0,0,0,PROT_NAME(ANSWERSHAREDDIRS) ,"cce35f",NULL,"<Directory list>" }, #define ANSWERSHAREDFILES4DIR 0x60 -// { 1,0,0,0,0,0,0,PROT_NAME(ANSWERSHAREDFILES4DIR),NULL,"<Directory> <File info list>" }, +// { 1,0,0,0,0,0,0,PROT_NAME(ANSWERSHAREDFILES4DIR),"cce360",NULL,"<Directory> <File info list>" }, #define ANSWERSHAREDDENIED 0x61 - { 1,0,0,0,0,0,0,PROT_NAME(ANSWERSHAREDDENIED) ,NULL,"" }, + { 1,0,0,0,0,0,0,PROT_NAME(ANSWERSHAREDDENIED) ,"cce361",NULL,"" }, // extened prot client <-> extened prot client #define EMULEINFO 0x01 - { 0,1,0,0,0,0,0,PROT_NAME(EMULEINFO) ,NULL,"<BYTE>client_version<BYTE>protocol_version<DWORD>tagcount<TAG>tag[tagcount]" }, + { 0,1,0,0,0,0,0,PROT_NAME(EMULEINFO) ,"ccc5e301",NULL,"<BYTE>client_version<BYTE>protocol_version<DWORD>tagcount<TAG>tag[tagcount]" }, // Values: ET_COMPRESSION ET_UDPPORT ET_UDPVER ET_SOURCEEXCHANGE ET_COMMENTS ET_EXTENDEDREQUEST ET_COMPATABLECLIENT ET_MOD_VERSION #define EMULEINFOANSWER 0x02 - { 0,1,0,0,0,0,0,PROT_NAME(EMULEINFOANSWER) ,NULL,"<BYTE>client_version<BYTE>protocol_version<DWORD>tagcount<TAG>tag[tagcount]" }, + { 0,1,0,0,0,0,0,PROT_NAME(EMULEINFOANSWER) ,"ccc502",NULL,"<BYTE>client_version<BYTE>protocol_version<DWORD>tagcount<TAG>tag[tagcount]" }, // // CONFORMING TO "eDonkey-protocol-0.6.1" and comfirming to the xMule sources, // a part may be split down to several packets. Each packet _may_ have same // value for range. #define COMPRESSEDPART 0x40 - { 0,1,0,0,0,0,0,PROT_NAME(COMPRESSEDPART) ,NULL,"<HASH>file_hash<RANGE>range<BYTE>cdata[range]" }, + { 0,1,0,0,0,0,0,PROT_NAME(COMPRESSEDPART) ,"ccc540",NULL,"<HASH>file_hash<RANGE>range<BYTE>cdata[range]" }, #define QUEUERANKING 0x60 - { 0,1,0,0,0,0,0,PROT_NAME(QUEUERANKING) ,NULL,"<WORD>rank<DWORD>unknown1=0<DWORD>unknown2=0<WORD>unknown3=0" }, + { 0,1,0,0,0,0,0,PROT_NAME(QUEUERANKING) ,"ccc560",NULL,"<WORD>rank<DWORD>unknown1=0<DWORD>unknown2=0<WORD>unknown3=0" }, // "eDonkey-protocol-0.6.1" doesn't know anything about 0x61: #define FILEDESC 0x61 // max len = 128 [Why the hell is comment_len a 32 bit value, and than limited to 128 bytes?] - { 0,1,0,0,0,0,0,PROT_NAME(FILEDESC) ,NULL,"<BYTE>quality_rating<DWORD>comment_len<CHAR>comment[comment_len]" }, + { 0,1,0,0,0,0,0,PROT_NAME(FILEDESC) ,"ccc561",NULL,"<BYTE>quality_rating<DWORD>comment_len<CHAR>comment[comment_len]" }, #define REQUESTSOURCES 0x81 - { 0,1,0,0,0,0,0,PROT_NAME(REQUESTSOURCES) ,NULL,"<HASH>file_hash" }, + { 0,1,0,0,0,0,0,PROT_NAME(REQUESTSOURCES) ,"ccc581",NULL,"<HASH>file_hash" }, #define ANSWERSOURCES 0x82 - { 0,1,0,0,0,0,0,PROT_NAME(ANSWERSOURCES) ,NULL,"<HASH>file_hash<WORD>num_sources{<IPPORT>server<IPPORT>client}source[num_sources]" }, + { 0,1,0,0,0,0,0,PROT_NAME(ANSWERSOURCES) ,"ccc582",NULL,"<HASH>file_hash<WORD>num_sources{<IPPORT>server<IPPORT>client}source[num_sources]" }, // extened prot client <-> extened prot client UDP #define REASKFILEPING 0x90 - { 0,1,0,0,0,0,0,PROT_NAME(REASKFILEPING) ,NULL,"<HASH>file_hash" }, + { 0,1,0,0,0,0,0,PROT_NAME(REASKFILEPING) ,"ccc590",NULL,"<HASH>file_hash" }, #define REASKACK 0x91 - { 0,1,0,0,0,0,0,PROT_NAME(REASKACK) ,NULL,"<WORD>rank" }, + { 0,1,0,0,0,0,0,PROT_NAME(REASKACK) ,"ccc591",NULL,"<WORD>rank" }, #define FILENOTFOUND 0x92 - { 0,1,0,0,0,0,0,PROT_NAME(FILENOTFOUND) ,NULL,"" }, + { 0,1,0,0,0,0,0,PROT_NAME(FILENOTFOUND) ,"ccc592",NULL,"" }, #define QUEUEFULL 0x93 - { 0,1,0,0,0,0,0,PROT_NAME(QUEUEFULL) ,NULL,"" }, + { 0,1,0,0,0,0,0,PROT_NAME(QUEUEFULL) ,"ccc593",NULL,"" }, // unknown: (?extened prot client <-> extened prot client?) #define VERIFYUPSREQ 0x71 // (never used) */ - { 0,1,0,0,0,0,0,PROT_NAME(VERIFYUPSREQ) ,NULL,"" }, + { 0,1,0,0,0,0,0,PROT_NAME(VERIFYUPSREQ) ,"ccc571",NULL,"" }, #define VERIFYUPSANSWER 0x72 // (never used) */ - { 0,1,0,0,0,0,0,PROT_NAME(VERIFYUPSANSWER) ,NULL,"" }, + { 0,1,0,0,0,0,0,PROT_NAME(VERIFYUPSANSWER) ,"ccc572",NULL,"" }, #define UDPVERIFYUPREQ 0x73 // (never used) */ - { 0,1,0,0,0,0,0,PROT_NAME(UDPVERIFYUPREQ) ,NULL,"" }, + { 0,1,0,0,0,0,0,PROT_NAME(UDPVERIFYUPREQ) ,"ccc573",NULL,"" }, #define UDPVERIFYUPA 0x74 // (never used) - { 0,1,0,0,0,0,0,PROT_NAME(UDPVERIFYUPA) ,NULL,"" } + { 0,1,0,0,0,0,0,PROT_NAME(UDPVERIFYUPA) ,"ccc574",NULL,"" } }; struct typestruct real_type[]={ @@ -1063,33 +1064,48 @@ return true; } -int find_parsestruct_by_name_compare(const void * key, const void * i) { +int find_parsestruct_by_name_compare_name(const void * key, const void * i) { return strcmp((char*)key,packet[*(int*)i].name); } +int find_parsestruct_by_name_compare_altname(const void * key, const void * i) { + return strcmp((char*)key,packet[*(int*)i].altname); +} + bool find_parsestruct_by_name( const char * name, const struct parsestruct * * element ) { - static int bsearchtable[sizeof packet / sizeof *packet]; + static int bsearchtable_name [sizeof packet / sizeof *packet]; + static int bsearchtable_altname[sizeof packet / sizeof *packet]; static bool first=true; int * intp; if (first) { int i,j; - for (i=0;i<sizeof packet / sizeof *packet;++i) - bsearchtable[i]=i; + for (i=0;i<sizeof packet / sizeof *packet;++i) { + bsearchtable_name [i]=i; + bsearchtable_altname[i]=i; + } for (i=0;i<sizeof packet / sizeof *packet-1;++i) { for (j=i+1;j<sizeof packet / sizeof *packet;++j) { if (strcmp( - packet[bsearchtable[i]].name, - packet[bsearchtable[j]].name + packet[bsearchtable_name[i]].name, + packet[bsearchtable_name[j]].name )>0) { - int t=bsearchtable[i]; - bsearchtable[i]=bsearchtable[j]; - bsearchtable[j]=t; + int t=bsearchtable_name[i]; + bsearchtable_name[i]=bsearchtable_name[j]; + bsearchtable_name[j]=t; + } + if (strcmp( + packet[bsearchtable_altname[i]].altname, + packet[bsearchtable_altname[j]].altname + )>0) { + int t=bsearchtable_altname[i]; + bsearchtable_altname[i]=bsearchtable_altname[j]; + bsearchtable_altname[j]=t; } } } @@ -1098,14 +1114,28 @@ } intp=(int*)bsearch( - name,bsearchtable, + name,bsearchtable_name, sizeof(packet) / sizeof(*packet), - sizeof(int),find_parsestruct_by_name_compare + sizeof(int),find_parsestruct_by_name_compare_name ); - if (!intp) return false; - - *element=packet[bsearchtable[*intp]].element; + if (intp) { + // *element=packet[bsearchtable_name[*intp]].element; + *element=packet[*intp].element; + } else { + intp=(int*)bsearch( + name,bsearchtable_altname, + sizeof(packet) / sizeof(*packet), + sizeof(int),find_parsestruct_by_name_compare_altname + ); + + if (intp) { + // *element=packet[bsearchtable_altname[*intp]].element; + *element=packet[*intp].element; + } else { + return false; + } + } return true; } Index: test.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/test.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- test.cpp 26 Nov 2003 02:07:04 -0000 1.29 +++ test.cpp 9 Dec 2003 00:16:29 -0000 1.30 @@ -770,6 +770,36 @@ u32 * OurClientID=NULL; u32 * connection_id=NULL; +std::map<char,unsigned> hexdigit2value; +bool hexdigit2value_initialised=false; + +ParseClass * GetParseClass(const char * proto_opcode) { + const parsestruct * ps; + unsigned p,o; + + if (PClist[proto_opcode]) { + return PClist[proto_opcode]; + } + + if (find_parsestruct_by_name(proto_opcode,&ps)) { + return PClist[proto_opcode]=new ParseClass(ps); + } + + p=16*hexdigit2value[proto_opcode[0]]+hexdigit2value[proto_opcode[1]]; + o=16*hexdigit2value[proto_opcode[2]]+hexdigit2value[proto_opcode[3]]; + + if (!packet_description(p,o,&ps,NULL)) { + fprintf( + stderr + ,"%s:%i: FATAL: Couldn't find ps for packet 0x%02x,0x%02x.\n" + ,__FILE__,__LINE__,p,o + ); + abort(); + } + + return PClist[proto_opcode]=new ParseClass(ps); +} + void Client_Tcp_Sending_Hello_Packet(u32 id) { bool rc; Ed2kPacket p; @@ -781,6 +811,38 @@ 0x0f,DEFAULT_CLIENTPORT, ipport(MY_IP,DEFAULT_SERVERPORT) ); + + ParseClass * PC=GetParseClass("HELLO"); // e301 + const ipport & client=ipport(MY_IP,DEFAULT_CLIENTPORT); + const ipport & server=ipport(MY_IP,DEFAULT_SERVERPORT); + tag tag; + + PC->Set((u8)0x10,"magic"); + PC->Set(userhash,"user_hash"); + PC->Set(client, "address"); + PC->Set((u32)3, "tagcount"); + + tag.type=TAG_TYPE_STRING; + tag.id_len=1; + tag.id.number=0x01; + tag.value.string.content=(u8*)"bothie tests his xMule v2 core"; + tag.value.string.length=strlen((char*)tag.value.string.content); + PC->Set(tag, "tag[0]"); + + tag.type=TAG_TYPE_DWORD; + tag.id.number=0x11; + tag.value.dword=60; + PC->Set(tag, "tag[1]"); + + tag.id.number=0x0f; + tag.value.dword=DEFAULT_CLIENTPORT; + PC->Set(tag, "tag[2]"); + + PC->Set(server, "server_address"); +/* + PC->Write(p); +*/ + printf( "Sending packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", (long unsigned)id,(long unsigned)Connection::GetSocket(id).GetIP(), @@ -895,7 +957,7 @@ if (!PClist[proto_opcode]) PClist[proto_opcode]=new ParseClass(ps); PC=PClist[proto_opcode]; - PC->Read(p.GetPtr(),p.GetSize()); + PC->Read(p); switch ((u16)p.GetProtocol()*0x100+p.GetOpcode()) { case 0xe338: // Servermessage @@ -963,6 +1025,10 @@ Log(tmp); free(tmp); Connection::SetStatus(id,SERVER_TCP_INITIAL_OFFER_FILES); + /* + * Ask for all sources, and afterwards offer files. + */ + // e315: "<DWORD>filecount{<HASH>hash<IPPORT>source<DWORD>tagcount<TAG>tag[tagcount]}file[filecount]" }, ++num_connected; break; @@ -1164,6 +1230,7 @@ u32 ip; u16 port; bool rc; + int i; #ifndef NDEBUG #ifdef HAVE_BTLINUXLIBRARY @@ -1176,6 +1243,14 @@ parse_all(); parse_something(); + + for (i=0;i<10;++i) { + hexdigit2value['0'+i]=i; + } + for (i=0;i<6;++i) { + hexdigit2value['a'+i]=10+i; + hexdigit2value['A'+i]=10+i; + } if (argc!=3 && argc!=1) return usage(argv[0]); |
From: <bo...@us...> - 2003-12-08 20:07:44
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv18815 Modified Files: Makefile.cvs Log Message: Corrected miss-spelling (MAXOSX) and now -DWIN32 and -DMACOSX will actually be set. Index: Makefile.cvs =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Makefile.cvs,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.cvs 26 Nov 2003 02:06:02 -0000 1.13 +++ Makefile.cvs 8 Dec 2003 20:07:41 -0000 1.14 @@ -35,7 +35,7 @@ # If you have a Mac OS X system, ... -# MAXOSX = true +# MACOSX = true # Do you want colored debug output? If yes, uncomment the following line. @@ -51,15 +51,19 @@ CC = gcc -b i686-mingw32msvc LDFLAGS += -lwsock32 BINARY = test.exe +CPPFLAGS += -DWIN32 endif ifdef LINUX BINARY = test +CPPFLAGS += -DLINUX endif -ifdef MAXOSX +ifdef MACOSX BINARY = test +CPPFLAGS += -DMACOSX endif + all: $(BINARY) |