Browse Source

Now refreshes directories after running cmake for compilation_commands.json.

merge-requests/365/head
eidheim 10 years ago
parent
commit
017d4480a7
  1. 5
      src/notebook.cc
  2. 4
      src/notebook.h
  3. 2
      src/window.cc
  4. 2
      src/window.h

5
src/notebook.cc

@ -12,7 +12,7 @@ namespace sigc {
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
} }
Notebook::Notebook() : Gtk::Notebook() { Notebook::Notebook(Directories &directories) : Gtk::Notebook(), directories(directories) {
Gsv::init(); Gsv::init();
} }
@ -174,7 +174,8 @@ bool Notebook::make_compile_commands(const std::string &path) {
Singleton::terminal()->print("Creating "+boost::filesystem::path(path+"/compile_commands.json").string()+"\n"); Singleton::terminal()->print("Creating "+boost::filesystem::path(path+"/compile_commands.json").string()+"\n");
//TODO: Windows... //TODO: Windows...
if(Singleton::terminal()->execute(path, "cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON 2>&1")) { if(Singleton::terminal()->execute(path, "cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON 2>&1")) {
//TODO: refresh directories if(project_path!="")
directories.open_folder(project_path);
return true; return true;
} }
return false; return false;

4
src/notebook.h

@ -8,10 +8,11 @@
#include <type_traits> #include <type_traits>
#include <map> #include <map>
#include <sigc++/sigc++.h> #include <sigc++/sigc++.h>
#include "directories.h"
class Notebook : public Gtk::Notebook { class Notebook : public Gtk::Notebook {
public: public:
Notebook(); Notebook(Directories &directories);
Source::View* get_view(int page); Source::View* get_view(int page);
int size(); int size();
Source::View* get_current_view(); Source::View* get_current_view();
@ -25,6 +26,7 @@ private:
std::string find_project_path(const std::string &path); std::string find_project_path(const std::string &path);
bool make_compile_commands(const std::string &path); bool make_compile_commands(const std::string &path);
bool save_modified_dialog(); bool save_modified_dialog();
Directories &directories;
std::vector<Source::View*> source_views; //Is NOT freed in destructor, this is intended for quick program exit. std::vector<Source::View*> source_views; //Is NOT freed in destructor, this is intended for quick program exit.
std::vector<std::unique_ptr<Gtk::ScrolledWindow> > scrolled_windows; std::vector<std::unique_ptr<Gtk::ScrolledWindow> > scrolled_windows;
std::vector<std::unique_ptr<Gtk::HBox> > hboxes; std::vector<std::unique_ptr<Gtk::HBox> > hboxes;

2
src/window.cc

@ -12,7 +12,7 @@ namespace sigc {
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
} }
Window::Window() : box(Gtk::ORIENTATION_VERTICAL) { Window::Window() : box(Gtk::ORIENTATION_VERTICAL), notebook(directories) {
INFO("Create Window"); INFO("Create Window");
set_title("juCi++"); set_title("juCi++");
set_default_size(600, 400); set_default_size(600, 400);

2
src/window.h

@ -10,8 +10,8 @@
class Window : public Gtk::Window { class Window : public Gtk::Window {
public: public:
Window(); Window();
Notebook notebook;
Directories directories; Directories directories;
Notebook notebook;
protected: protected:
bool on_key_press_event(GdkEventKey *event); bool on_key_press_event(GdkEventKey *event);
bool on_delete_event (GdkEventAny *event); bool on_delete_event (GdkEventAny *event);

Loading…
Cancel
Save