00001 /* 00002 * Copyright (c) 2008, Willow Garage, Inc. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of the Willow Garage, Inc. nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 #ifndef RVIZ_VISUALIZATION_FRAME_H 00031 #define RVIZ_VISUALIZATION_FRAME_H 00032 00033 #include "window_manager_interface.h" 00034 00035 #include <wx/frame.h> 00036 00037 #include <string> 00038 #include <deque> 00039 #include <boost/shared_ptr.hpp> 00040 00041 class wxConfigBase; 00042 class wxMenuBar; 00043 class wxMenu; 00044 class wxAuiManager; 00045 class wxAuiManagerEvent; 00046 class wxToolBar; 00047 00048 namespace rviz 00049 { 00050 00051 class RenderPanel; 00052 class DisplaysPanel; 00053 class ViewsPanel; 00054 class TimePanel; 00055 class SelectionPanel; 00056 class ToolPropertiesPanel; 00057 class VisualizationManager; 00058 class Tool; 00059 class SplashScreen; 00060 00061 class VisualizationFrame : public wxFrame, public WindowManagerInterface 00062 { 00063 public: 00064 VisualizationFrame(wxWindow* parent); 00065 ~VisualizationFrame(); 00066 00067 void initialize(const std::string& display_config_file = "", const std::string& fixed_frame = "", const std::string& target_frame = ""); 00068 00069 VisualizationManager* getManager() { return manager_; } 00070 00071 // overrides from WindowManagerInterface 00072 virtual wxWindow* getParentWindow(); 00073 virtual void addPane(const std::string& name, wxWindow* panel); 00074 virtual void removePane(wxWindow* panel); 00075 virtual void showPane(wxWindow* panel); 00076 virtual void closePane(wxWindow* panel); 00077 00078 protected: 00079 void initConfigs(); 00080 void initMenus(); 00081 void loadDisplayConfig(const std::string& path); 00082 void saveConfigs(); 00083 00084 // wx Callbacks 00085 void onClose(wxCommandEvent& event); 00086 void onOpen(wxCommandEvent& event); 00087 void onSave(wxCommandEvent& event); 00089 void onToolClicked( wxCommandEvent& event ); 00090 void onPaneClosed(wxAuiManagerEvent& event); 00091 void onViewMenuItemSelected(wxCommandEvent& event); 00092 void onManagePlugins(wxCommandEvent& event); 00093 void onHelpWiki(wxCommandEvent& event); 00094 void onRecentConfigSelected(wxCommandEvent& event); 00095 00096 // other Callbacks 00097 void onToolAdded(Tool* tool); 00098 void onToolChanged(Tool* tool); 00099 00100 void onSplashLoadStatus(const std::string& status, SplashScreen* splash); 00101 00102 void markRecentConfig(const std::string& path); 00103 void updateRecentConfigMenu(); 00104 00105 RenderPanel* render_panel_; 00106 DisplaysPanel* displays_panel_; 00107 ViewsPanel* views_panel_; 00108 TimePanel* time_panel_; 00109 SelectionPanel* selection_panel_; 00110 ToolPropertiesPanel* tool_properties_panel_; 00111 00112 boost::shared_ptr<wxConfigBase> general_config_; 00113 boost::shared_ptr<wxConfigBase> display_config_; 00114 std::string config_dir_; 00115 std::string general_config_file_; 00116 std::string display_config_file_; 00117 std::string last_config_dir_; 00118 00119 wxMenuBar* menubar_; 00120 wxMenu* file_menu_; 00121 wxMenu* recent_configs_menu_; 00122 wxMenu* view_menu_; 00123 wxMenu* plugins_menu_; 00124 wxMenu* help_menu_; 00125 00126 wxToolBar* toolbar_; 00127 00128 wxAuiManager* aui_manager_; 00129 00130 VisualizationManager* manager_; 00131 00132 std::string package_path_; 00133 00134 SplashScreen* splash_; 00135 00136 typedef std::deque<std::string> D_string; 00137 D_string recent_configs_; 00138 }; 00139 00140 } 00141 00142 #endif // RVIZ_VISUALIZATION_FRAME_H