Browse Source

created constructor to api, and added it to window

master
tedjk 11 years ago
parent
commit
14313e817e
  1. 7
      juci/api.cc
  2. 1
      juci/api.h
  3. 7
      juci/config.cc
  4. 7
      juci/window.cc
  5. 1
      juci/window.h

7
juci/api.cc

@ -5,6 +5,13 @@ Notebook::Controller* PluginApi::notebook_;
///////////////////////////// /////////////////////////////
//// API ServiceProvider //// //// API ServiceProvider ////
///////////////////////////// /////////////////////////////
PluginApi::PluginApi(Menu::Controller& menu_ctl_,
Notebook::Controller& notebook_ctl_) {
menu_ = &menu_ctl_;
notebook_ = &notebook_ctl_;
InitPlugins();
}
std::string PluginApi::ProjectPath() { std::string PluginApi::ProjectPath() {
int MAXPATHLEN = 50; int MAXPATHLEN = 50;
char temp[MAXPATHLEN]; char temp[MAXPATHLEN];

1
juci/api.h

@ -12,6 +12,7 @@
//////////////////// ////////////////////
class PluginApi { class PluginApi {
public: public:
PluginApi(Menu::Controller&, Notebook::Controller&);
static Menu::Controller* menu_; static Menu::Controller* menu_;
static Notebook::Controller* notebook_; static Notebook::Controller* notebook_;
static void InitPlugins(); static void InitPlugins();

7
juci/config.cc

@ -6,19 +6,16 @@ MainConfig::MainConfig() :
GenerateSource(); GenerateSource();
GenerateKeybindings(); GenerateKeybindings();
GenerateDirectoryFilter(); GenerateDirectoryFilter();
// keybindings_cfg_ = cfg_.get_child("keybindings");
// notebook_cfg_ = cfg_.get_child("notebook");
// menu_cfg_ = cfg_.get_child("menu");
} }
void MainConfig::GenerateSource() { void MainConfig::GenerateSource() {
boost::property_tree::ptree source_json = cfg_.get_child("source"); boost::property_tree::ptree source_json = cfg_.get_child("source");
boost::property_tree::ptree syntax_json = source_json.get_child("syntax"); boost::property_tree::ptree syntax_json = source_json.get_child("syntax");
boost::property_tree::ptree colors_json = source_json.get_child("colors"); boost::property_tree::ptree colors_json = source_json.get_child("colors");
for ( auto &i : colors_json ) { for (auto &i : colors_json) {
source_cfg_.InsertTag(i.first, i.second.get_value<std::string>()); source_cfg_.InsertTag(i.first, i.second.get_value<std::string>());
} }
for ( auto &i : syntax_json ) { for (auto &i : syntax_json) {
source_cfg_.InsertType(i.first, i.second.get_value<std::string>()); source_cfg_.InsertType(i.first, i.second.get_value<std::string>());
} }
} }

7
juci/window.cc

@ -5,7 +5,8 @@ Window::Window() :
main_config_(), main_config_(),
keybindings_(main_config_.keybindings_cfg()), keybindings_(main_config_.keybindings_cfg()),
notebook_(this,keybindings(), main_config_.source_cfg(), main_config_.dir_cfg()), notebook_(this,keybindings(), main_config_.source_cfg(), main_config_.dir_cfg()),
menu_(keybindings()) { menu_(keybindings()),
api_(menu_, notebook_) {
set_title("juCi++"); set_title("juCi++");
set_default_size(600, 400); set_default_size(600, 400);
add(window_box_); add(window_box_);
@ -78,10 +79,6 @@ Window::Window() :
terminal_.Terminal().signal_button_release_event(). terminal_.Terminal().signal_button_release_event().
connect(sigc::mem_fun(*this,&Window::OnMouseRelease),false); connect(sigc::mem_fun(*this,&Window::OnMouseRelease),false);
PluginApi::menu_ = &menu_;
PluginApi::notebook_ = &notebook_;
PluginApi::InitPlugins();
add_accel_group(keybindings_.ui_manager_menu()->get_accel_group()); add_accel_group(keybindings_.ui_manager_menu()->get_accel_group());
add_accel_group(keybindings_.ui_manager_hidden()->get_accel_group()); add_accel_group(keybindings_.ui_manager_hidden()->get_accel_group());
keybindings_.BuildMenu(); keybindings_.BuildMenu();

1
juci/window.h

@ -22,6 +22,7 @@ public:
Menu::Controller menu_; Menu::Controller menu_;
Notebook::Controller notebook_; Notebook::Controller notebook_;
Terminal::Controller terminal_; Terminal::Controller terminal_;
PluginApi api_;
Keybindings::Controller& keybindings() { return keybindings_; } Keybindings::Controller& keybindings() { return keybindings_; }
private: private:

Loading…
Cancel
Save