From 0678ac68c8deec8a013fcc9afe18ec388a391ba2 Mon Sep 17 00:00:00 2001 From: oyvang Date: Fri, 15 May 2015 12:49:28 +0200 Subject: [PATCH] Fixed keybinding on compile and run --- juci/config.json | 2 +- juci/notebook.cc | 2 +- juci/terminal.cc | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/juci/config.json b/juci/config.json index 9344fbb..bf406f5 100644 --- a/juci/config.json +++ b/juci/config.json @@ -27,7 +27,7 @@ "edit_undo": "z", "save": "s", "save_as": "s", - "compile_and_run": "r>", + "compile_and_run": "r", "compile": "r" }, "directoryfilter": { diff --git a/juci/notebook.cc b/juci/notebook.cc index 44470e9..47dd4ef 100644 --- a/juci/notebook.cc +++ b/juci/notebook.cc @@ -272,7 +272,7 @@ bool Notebook::Controller::ScrollEventCallback(GdkEventScroll* scroll_event) { } Notebook::Controller::~Controller() { INFO("Notebook destructor"); - for (auto &i : text_vec_) delete i; + for (auto &i : text_vec_) delete i; for (auto &i : linenumbers_vec_) delete i; for (auto &i : editor_vec_) delete i; for (auto &i : scrolledtext_vec_) delete i; diff --git a/juci/terminal.cc b/juci/terminal.cc index cd916d8..1ea2029 100644 --- a/juci/terminal.cc +++ b/juci/terminal.cc @@ -1,8 +1,7 @@ #include "terminal.h" #include #include -// #include -// #include +#include "logging.h" Terminal::View::View(){ @@ -19,31 +18,43 @@ Terminal::Controller::Controller() { void Terminal::Controller::SetFolderCommand( boost::filesystem::path CMake_path) { - + INFO("Terminal: SetFolderCommand"); path_ = CMake_path.string(); folder_command_ = "cd "+ path_ + "; "; } void Terminal::Controller::Compile(){ + INFO("Terminal: Compile"); Terminal().get_buffer()->set_text(""); + DEBUG("Terminal: Compile: running cmake command"); ExecuteCommand("cmake .", "r"); if (ExistInConsole(cmake_sucsess)){ + DEBUG("Terminal: Compile: running make command"); ExecuteCommand("make", "r"); - } + } + PrintMessage("\n"); + DEBUG("Terminal: Compile: compile done"); } void Terminal::Controller::Run(std::string executable) { + INFO("Terminal: Run"); PrintMessage("juCi++ execute: " + executable + "\n"); + DEBUG("Terminal: Compile: running run command: "); + DEBUG_VAR(executable); ExecuteCommand("./"+executable, "r"); + PrintMessage("\n"); } void Terminal::Controller::PrintMessage(std::string message){ + INFO("Terminal: PrintMessage"); Terminal().get_buffer()-> insert(Terminal().get_buffer()-> end(),"> "+message); } bool Terminal::Controller::ExistInConsole(std::string string) { + INFO("Terminal: ExistInConsole"); + DEBUG("Terminal: PrintMessage: finding string in buffer"); double pos = Terminal().get_buffer()-> get_text().find(string); if (pos == std::string::npos) return false; @@ -51,8 +62,10 @@ bool Terminal::Controller::ExistInConsole(std::string string) { } void Terminal::Controller::ExecuteCommand(std::string command, std::string mode) { + INFO("Terminal: ExecuteCommand"); command = folder_command_+command; - std::cout << "EXECUTE COMMAND: "<< command << std::endl; + DEBUG("Terminal: PrintMessage: Running command"); + DEBUG_VAR(command); FILE* p = popen(command.c_str(), mode.c_str()); if (p == NULL) {