From 5956da42deb9602e04042705155291bd124896eb Mon Sep 17 00:00:00 2001 From: guigues Date: Thu, 26 Jun 2008 06:35:36 +0000 Subject: [PATCH] *** empty log message *** --- kernel/appli/CMakeLists.txt | 7 +- kernel/appli/bbPackageBrowser/CMakeLists.txt | 14 ++ .../bbPackageBrowser/bbPackageBrowser.cxx | 197 ++++++++++++++++++ kernel/doc/bbtkWebSite/menu.html | 3 + 4 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 kernel/appli/bbPackageBrowser/CMakeLists.txt create mode 100644 kernel/appli/bbPackageBrowser/bbPackageBrowser.cxx diff --git a/kernel/appli/CMakeLists.txt b/kernel/appli/CMakeLists.txt index 44c49a7..fa74e8d 100644 --- a/kernel/appli/CMakeLists.txt +++ b/kernel/appli/CMakeLists.txt @@ -1,5 +1,5 @@ -# Replace strings in a file +# Replace strings in a file (sed for windows) SUBDIRS(bbSed) # The BlackBox Interpreter @@ -19,10 +19,13 @@ SUBDIRS(bbCreatePackage) # Utility that creates a new user black box SUBDIRS(bbCreateBlackBox) +# The black box script developer SUBDIRS(bbed) -SUBDIRS(bbhelp) +# The black box package browser +SUBDIRS(bbPackageBrowser) +# SUBDIRS(bbs2cpp) SUBDIRS(bbc) diff --git a/kernel/appli/bbPackageBrowser/CMakeLists.txt b/kernel/appli/bbPackageBrowser/CMakeLists.txt new file mode 100644 index 0000000..9ff5e69 --- /dev/null +++ b/kernel/appli/bbPackageBrowser/CMakeLists.txt @@ -0,0 +1,14 @@ + +SET(SOURCES bbPackageBrowser ) + + +IF(BBTK_USE_WXWIDGETS AND WIN32) + ADD_EXECUTABLE(bbPackageBrowser WIN32 ${SOURCES}) +# SET_TARGET_PROPERTIES(bbPackageBrowser PROPERTIES LINK_FLAGS /subsystem:console ) +ELSE(BBTK_USE_WXWIDGETS AND WIN32) + ADD_EXECUTABLE(bbPackageBrowser ${SOURCES}) +ENDIF(BBTK_USE_WXWIDGETS AND WIN32) + + +TARGET_LINK_LIBRARIES(bbPackageBrowser bbtk) +INSTALL_TARGETS(/bin/ bbPackageBrowser) diff --git a/kernel/appli/bbPackageBrowser/bbPackageBrowser.cxx b/kernel/appli/bbPackageBrowser/bbPackageBrowser.cxx new file mode 100644 index 0000000..d7e5d44 --- /dev/null +++ b/kernel/appli/bbPackageBrowser/bbPackageBrowser.cxx @@ -0,0 +1,197 @@ +#ifdef _USE_WXWIDGETS_ + + + +//========================================================================== +// WITH WX +//========================================================================== +#include "bbtkInterpreter.h" +#include "bbtkWxGUIHtmlBrowser.h" +#include "bbtkWxGUIPackageBrowser2.h" + +#include "../../src/icons/cc_run.xpm" +#include "../../src/icons/cc_exit.xpm" + +using namespace bbtk; + +class /*BBTK_EXPORT*/ WxGUIHelp : public wxFrame +// public InterpreterUser +{ +public: + WxGUIHelp( wxWindow *parent, wxString title, wxSize size ); + ~WxGUIHelp(); + void OnButtonRun(wxCommandEvent& WXUNUSED(event)); + void OnButtonQuit(wxCommandEvent& WXUNUSED(event)); + + // WxGUIHtmlBrowser* mWxGUIHtmlBrowser; + WxGUIPackageBrowser2* mWxGUIPackageBrowser; + // wxButton* mwxButtonRun; + wxButton* mwxButtonQuit; + +// bool InterpreterUserHasOwnHtmlPageViewer() { return false; } +// void InterpreterUserViewHtmlPage(const std::string&) {} + + DECLARE_EVENT_TABLE(); +}; + +enum + { + ID_Button_Run, + ID_Button_Quit + }; + +WxGUIHelp::WxGUIHelp( wxWindow *parent, wxString title, wxSize size ) + : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size) +// InterpreterUser() +{ + wxBoxSizer *helpsizer = new wxBoxSizer(wxVERTICAL); + // mWxGUIHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0)); + // helpsizer->Add (mWxGUIHtmlBrowser,1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5 ); + mWxGUIPackageBrowser = new WxGUIPackageBrowser2(this); + helpsizer->Add (mWxGUIPackageBrowser,1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxBoxSizer *btnsizer = new wxBoxSizer(wxHORIZONTAL); + /* + wxBitmap bmp_run(cc_run_xpm); + mwxButtonRun = new wxBitmapButton(this,ID_Button_Run,bmp_run); + btnsizer->Add( mwxButtonRun, 0, wxALL, 5 ); + */ + wxBitmap bmp_quit(cc_exit_xpm); + mwxButtonQuit = new wxBitmapButton(this,ID_Button_Quit,bmp_quit); + btnsizer->Add( mwxButtonQuit, 0, wxALL, 5 ); + + helpsizer->Add( btnsizer ); + + // Creates and sets the parent window of all bbtk windows + /* + wxWindow* top = new wxPanel(this,-1);//,_T("top")); + top->Hide(); + Wx::SetTopWindow(top); + */ + + SetSizer(helpsizer); + SetAutoLayout(true); + Layout(); + + // mWxGUIHtmlBrowser->GoHome(); + mWxGUIPackageBrowser->IncludeAll(); +} + +WxGUIHelp::~WxGUIHelp() {} + +/* +void WxGUIHelp::OnButtonRun(wxCommandEvent& WXUNUSED(event)) +{ + //std::string filename = wx2std(mWxGUIHtmlBrowser->GetCurrentPage()); + std::string filename = mWxGUIHtmlBrowser->GetCurrentPage(); + size_t s = filename.length(); + + Interpreter::Pointer I = Interpreter::New(); + I->SetThrow(true); + + if ((s>3) && (filename[s-1]=='s') + && (filename[s-2]=='b') + && (filename[s-3]=='b') + && (filename[s-4]=='.')) + { + try + { + I->InterpretFile(filename); + } + catch (QuitException e) + { + std::cout << "QuitException caught"<Show(true); + return true; +} + +/* +#if defined(_WIN32) + +// How to have a Console and wxWidgets +// http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide +// In Visual C++ 6 (7 should be similar), to create an application that is both a console application +// (cout's to the console are visible) and has a wxWidgets GUI, +// you need to use the linker option "/subsystem:console" and the following code: +int main(int argc, char* argv[]) +{ + return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL); +} +#endif // defined(_WIN32) +*/ + +#else +//========================================================================== +// WITHOUT WX +//========================================================================== +int main(int argc, char* argv[]) +{ + return 0; +} + +// EOF +#endif //#ifdef _USE_WXWIDGETS_ + + + diff --git a/kernel/doc/bbtkWebSite/menu.html b/kernel/doc/bbtkWebSite/menu.html index c65d13e..dee961f 100644 --- a/kernel/doc/bbtkWebSite/menu.html +++ b/kernel/doc/bbtkWebSite/menu.html @@ -14,6 +14,9 @@ License
bbtk Wiki
+bbtk users mailing list +
Demos