From: <ma...@us...> - 2003-11-23 12:14:56
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv24381 Modified Files: GUISettingsDlg.cpp MainDlg.cpp MainDlg.h defines.h wxInterface.wdr wxInterface_wdr.cpp Log Message: MenuBar View menu improved: Added some controls and now uses Radio/Check items (except wxMac where Radio items arent supported) Index: GUISettingsDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/GUISettingsDlg.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- GUISettingsDlg.cpp 23 Nov 2003 09:52:42 -0000 1.19 +++ GUISettingsDlg.cpp 23 Nov 2003 12:14:52 -0000 1.20 @@ -89,9 +89,9 @@ m_config->Read(wxT("Icon set"), &iconset, 0); m_config->Read(wxT("Show splashscreen"), &show_splash, true); m_config->Read(wxT("Prompt on exit"), &prompt_exit, true); - m_config->Read(wxT("Show toolbar"), &show_toolbar, true); - m_config->Read(wxT("Toolbar alignment"), &tool_align, 0); - m_config->Read(wxT("Show menubar"), &show_menubar, false); + m_config->Read(wxT("Show ToolBar"), &show_toolbar, true); + m_config->Read(wxT("Toolbar Alignment"), &tool_align, wxTB_HORIZONTAL); + m_config->Read(wxT("Show MenuBar"), &show_menubar, false); m_config->Read(wxT("Start page"), &startpage, 0); m_config->Read(wxT("Remember last"), &remember_last, true); @@ -170,11 +170,11 @@ * were changed - if so, we display a messagebox notifying that user * needs to restart the GUI for changes to take effect. */ - notfirstload = m_config->Read(wxT("Toolbar alignment"), &old_tool_align) + notfirstload = m_config->Read(wxT("Toolbar Alignment"), &old_tool_align) && notfirstload; - notfirstload = m_config->Read(wxT("Show toolbar"), &old_show_tool) + notfirstload = m_config->Read(wxT("Show ToolBar"), &old_show_tool) && notfirstload; - notfirstload = m_config->Read(wxT("Show menubar"), &old_show_menu) + notfirstload = m_config->Read(wxT("Show MenuBar"), &old_show_menu) && notfirstload; show_tool = GetShowTool()->GetValue(); tool_align = GetToolAlign()->GetSelection(); @@ -195,9 +195,9 @@ m_config->Write(wxT("Icon set"), GetIconSet()->GetSelection()); m_config->Write(wxT("Show splashscreen"), GetShowSplash()->GetValue()); m_config->Write(wxT("Prompt on exit"), GetPromptExit()->GetValue()); - m_config->Write(wxT("Show toolbar"), GetShowTool()->GetValue()); - m_config->Write(wxT("Toolbar alignment"), tool_align); - m_config->Write(wxT("Show menubar"), GetShowMenu()->GetValue()); + m_config->Write(wxT("Show ToolBar"), GetShowTool()->GetValue()); + m_config->Write(wxT("Toolbar Alignment"), tool_align); + m_config->Write(wxT("Show MenuBar"), GetShowMenu()->GetValue()); m_config->Write(wxT("Start page"), GetStartPage()->GetSelection()); m_config->Write(wxT("Remember last"), GetRememberLast()->GetValue()); Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- MainDlg.cpp 23 Nov 2003 10:11:00 -0000 1.5 +++ MainDlg.cpp 23 Nov 2003 12:14:53 -0000 1.6 @@ -216,12 +216,12 @@ /* Read configuration data */ bool show_tool = true; - m_config->Read(wxT("/General/Show toolbar"), &show_tool, true); + m_config->Read(wxT("/General/Show ToolBar"), &show_tool, true); if (!show_tool) { return; } m_config->Read( - wxT("/General/Toolbar alignment"), &tool_align, wxTB_HORIZONTAL + wxT("/General/Toolbar Alignment"), &tool_align, wxTB_HORIZONTAL ); /* Construct the toolbar object */ @@ -261,7 +261,7 @@ ); tb->AddTool( ID_BTN_STATISTICS, _("Statistics"), img->btn_statistics, - img->btn_statistics, wxITEM_CHECK, _("Show live statistics") ); + img->btn_statistics, wxITEM_CHECK, _("Show live statistics")); tb->AddSeparator(); tb->AddTool( ID_BTN_GUISETTINGS, _("Preferences"), img->btn_guisettings, @@ -276,12 +276,24 @@ * Last, but not least, we tell the toolbar which button should * initially toggled. */ - if (activewnd == serverwnd) tb->ToggleTool(ID_BTN_SERVERS, true); - if (activewnd == searchwnd) tb->ToggleTool(ID_BTN_SEARCH, true); - if (activewnd == transferwnd) tb->ToggleTool(ID_BTN_TRANSFER, true); - if (activewnd == sharedfileswnd) tb->ToggleTool(ID_BTN_SHARED_FILES, true); - if (activewnd == messageswnd) tb->ToggleTool(ID_BTN_MESSAGES, true); - if (activewnd == statisticswnd) tb->ToggleTool(ID_BTN_STATISTICS, true); + if (activewnd == serverwnd) { + tb->ToggleTool(ID_BTN_SERVERS, true); + } + if (activewnd == searchwnd) { + tb->ToggleTool(ID_BTN_SEARCH, true); + } + if (activewnd == transferwnd) { + tb->ToggleTool(ID_BTN_TRANSFER, true); + } + if (activewnd == sharedfileswnd) { + tb->ToggleTool(ID_BTN_SHARED_FILES, true); + } + if (activewnd == messageswnd) { + tb->ToggleTool(ID_BTN_MESSAGES, true); + } + if (activewnd == statisticswnd) { + tb->ToggleTool(ID_BTN_STATISTICS, true); + } } /** @@ -358,38 +370,84 @@ */ void CMainDlg::CreateMyMenuBar() { bool show_menu = false; + int tmp; + wxMenuBar *menubar = GetMenuBar(); if (menubar != NULL) { SetMenuBar(NULL); delete menubar; } - m_config->Read(wxT("/General/Show menubar"), &show_menu, false); + m_config->Read(wxT("/General/Show MenuBar"), &show_menu, false); if (!show_menu) { return; } menubar = new wxMenuBar(); + /* FILE MENU */ wxMenu *file_menu = new wxMenu(); file_menu->Append(ID_FILE_CONNECT, _("Connect")); file_menu->Append(ID_FILE_EXIT, _("Quit")); + /* EDIT MENU */ wxMenu *edit_menu = new wxMenu(); edit_menu->Append(ID_EDIT_GUI_SETTINGS, _("Preferences")); + /* VIEW MENU */ wxMenu *view_menu = new wxMenu(); + #ifdef wxHAS_RADIO_MENU_ITEMS + view_menu->AppendRadioItem(ID_VIEW_SERVERS, _("Servers")); + view_menu->AppendRadioItem(ID_VIEW_SEARCH, _("Search")); + view_menu->AppendRadioItem(ID_VIEW_TRANSFER, _("Transfer")); + view_menu->AppendRadioItem(ID_VIEW_SHARED_FILES, _("Shared Files")); + view_menu->AppendRadioItem(ID_VIEW_MESSAGES, _("Messages")); + view_menu->AppendRadioItem(ID_VIEW_STATISTICS, _("Statistics")); + #else view_menu->Append(ID_VIEW_SERVERS, _("Servers")); view_menu->Append(ID_VIEW_SEARCH, _("Search")); view_menu->Append(ID_VIEW_TRANSFER, _("Transfer")); view_menu->Append(ID_VIEW_SHARED_FILES, _("Shared Files")); view_menu->Append(ID_VIEW_MESSAGES, _("Messages")); view_menu->Append(ID_VIEW_STATISTICS, _("Statistics")); + #endif + view_menu->AppendSeparator(); + + view_menu->AppendCheckItem(ID_VIEW_MENUBAR, _("Show MenuBar")); + m_config->Read(wxT("/General/Show MenuBar"), &tmp, false); + view_menu->FindItem(ID_VIEW_MENUBAR)->Check(tmp); + + view_menu->AppendCheckItem(ID_VIEW_TOOLBAR, _("Show ToolBar")); + m_config->Read(wxT("/General/Show ToolBar"), &tmp, true); + view_menu->FindItem(ID_VIEW_TOOLBAR)->Check(tmp); + + wxMenu *view_tbar_menu = new wxMenu(); + #ifdef wxHAS_RADIO_MENU_ITEMS + view_tbar_menu->AppendRadioItem( + ID_VIEW_TBAR_ALIGN_HOR, _("Horizontal") + ); + view_tbar_menu->AppendRadioItem( + ID_VIEW_TBAR_ALIGN_VER, _("Vertical") + ); + m_config->Read(wxT("/General/Toolbar Alignment"), &tmp, 0); + if (tmp) { + view_tbar_menu->FindItem(ID_VIEW_TBAR_ALIGN_HOR)->Check(); + } else { + view_tbar_menu->FindItem(ID_VIEW_TBAR_ALIGN_VER)->Check(); + } + #else + view_tbar_menu->Append(ID_VIEW_TBAR_ALIGN_HOR, _("Horizontal")); + view_tbar_menu->Append(ID_VIEW_TBAR_ALIGN_VER, _("Vertical")); + #endif + + view_menu->Append(ID_VIEW_TBAR, _("ToolBar Alignment"), view_tbar_menu); + /* HELP MENU */ wxMenu *help_menu = new wxMenu(); help_menu->Append(ID_HELP_HELP, _("Help")); help_menu->Append(ID_HELP_ABOUT, _("About...")); + /* Tie everything together and set as menubar */ menubar->Append(file_menu, _("File")); menubar->Append(edit_menu, _("Edit")); menubar->Append(view_menu, _("View")); @@ -502,6 +560,56 @@ break; case ID_VIEW_STATISTICS: ShowPage(statisticswnd); + break; + case ID_VIEW_MENUBAR: + if ( + !(GetViewMenuBar()->IsChecked()) && + !(GetViewToolBar()->IsChecked()) + ) { + GetViewToolBar()->Check(true); + m_config->Write( + wxT("/General/Show ToolBar"), + GetViewToolBar()->IsChecked() + ); + CreateMyToolBar(); + } + m_config->Write( + wxT("/General/Show MenuBar"), + GetViewMenuBar()->IsChecked() + ); + CreateMyMenuBar(); + break; + case ID_VIEW_TOOLBAR: + if ( + !(GetViewMenuBar()->IsChecked()) && + !(GetViewToolBar()->IsChecked()) + ) { + GetViewMenuBar()->Check(true); + m_config->Write( + wxT("/General/Show MenuBar"), + GetViewMenuBar()->IsChecked() + ); + CreateMyMenuBar(); + } + m_config->Write( + wxT("/General/Show ToolBar"), + GetViewToolBar()->IsChecked() + ); + CreateMyToolBar(); + break; + case ID_VIEW_TBAR_ALIGN_HOR: + m_config->Write( + wxT("/General/ToolBar Alignment"), + wxTB_HORIZONTAL + ); + CreateMyToolBar(); + break; + case ID_VIEW_TBAR_ALIGN_VER: + m_config->Write( + wxT("/General/ToolBar Alignment"), + wxTB_VERTICAL + ); + CreateMyToolBar(); break; default: event.Skip(); Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- MainDlg.h 23 Nov 2003 09:52:43 -0000 1.3 +++ MainDlg.h 23 Nov 2003 12:14:53 -0000 1.4 @@ -84,6 +84,14 @@ void UpdateToolButtons(); wxWindow* GetCurPage() { return activewnd; } + /* Getters */ + wxMenuItem* GetViewMenuBar() { + return GetMenuBar()->FindItem(ID_VIEW_MENUBAR); + } + wxMenuItem* GetViewToolBar() { + return GetMenuBar()->FindItem(ID_VIEW_TOOLBAR); + } + /* Member variables */ bool show_tool; // Wether toolbar should be shown or not. bool start_up; // Should we remember last page Index: defines.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/defines.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- defines.h 23 Nov 2003 09:52:08 -0000 1.35 +++ defines.h 23 Nov 2003 12:14:53 -0000 1.36 @@ -82,6 +82,11 @@ ID_VIEW_SHARED_FILES, ID_VIEW_MESSAGES, ID_VIEW_STATISTICS, + ID_VIEW_MENUBAR, + ID_VIEW_TOOLBAR, + ID_VIEW_TBAR, + ID_VIEW_TBAR_ALIGN_HOR, + ID_VIEW_TBAR_ALIGN_VER, ID_HELP_HELP, ID_HELP_ABOUT, Index: wxInterface.wdr =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface.wdr,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsHnSzh2 and /tmp/cvscAmoxW differ Index: wxInterface_wdr.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface_wdr.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wxInterface_wdr.cpp 21 Nov 2003 12:46:10 -0000 1.2 +++ wxInterface_wdr.cpp 23 Nov 2003 12:14:53 -0000 1.3 @@ -850,7 +850,7 @@ wxBoxSizer *item26 = new wxBoxSizer( wxHORIZONTAL ); - wxCheckBox *item27 = new wxCheckBox( parent, ID_SHOWTOOL, _("Show toolbar"), wxDefaultPosition, wxDefaultSize, 0 ); + wxCheckBox *item27 = new wxCheckBox( parent, ID_SHOWTOOL, _("Show ToolBar"), wxDefaultPosition, wxDefaultSize, 0 ); item27->SetValue( TRUE ); item27->SetToolTip( _("Toggle wether toolbar is shown or not. Requires restart to take effect.") ); item26->Add( item27, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); @@ -866,7 +866,7 @@ item23->Add( item26, 0, wxALIGN_CENTER_VERTICAL, 5 ); - wxCheckBox *item29 = new wxCheckBox( parent, ID_SHOWMENU, _("Show menubar"), wxDefaultPosition, wxDefaultSize, 0 ); + wxCheckBox *item29 = new wxCheckBox( parent, ID_SHOWMENU, _("Show MenuBar"), wxDefaultPosition, wxDefaultSize, 0 ); item29->SetToolTip( _("Toggle wether menubar (file/view etc) should be shown or not. Requires restart to take effect.") ); item23->Add( item29, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); |