Browse Source

Made debug_label static also

merge-requests/365/head
eidheim 10 years ago
parent
commit
111028956d
  1. 7
      src/project.cc
  2. 6
      src/project.h
  3. 8
      src/window.cc

7
src/project.cc

@ -15,11 +15,10 @@ std::atomic<bool> Project::compiling;
std::atomic<bool> Project::debugging; std::atomic<bool> Project::debugging;
std::pair<boost::filesystem::path, std::pair<int, int> > Project::debug_stop; std::pair<boost::filesystem::path, std::pair<int, int> > Project::debug_stop;
boost::filesystem::path Project::debug_last_stop_file_path; boost::filesystem::path Project::debug_last_stop_file_path;
std::unique_ptr<Gtk::Label> Project::debug_status_label;
void Project::debug_update_status(const std::string &debug_status) { void Project::debug_update_status(const std::string &debug_status) {
if(debug_status.empty()) { if(debug_status.empty()) {
debug_status_label->set_text(""); debug_status_label().set_text("");
auto &menu=Menu::get(); auto &menu=Menu::get();
menu.actions["debug_stop"]->set_enabled(false); menu.actions["debug_stop"]->set_enabled(false);
menu.actions["debug_kill"]->set_enabled(false); menu.actions["debug_kill"]->set_enabled(false);
@ -32,7 +31,7 @@ void Project::debug_update_status(const std::string &debug_status) {
menu.actions["debug_goto_stop"]->set_enabled(false); menu.actions["debug_goto_stop"]->set_enabled(false);
} }
else { else {
debug_status_label->set_text("debug: "+debug_status); debug_status_label().set_text("debug: "+debug_status);
auto &menu=Menu::get(); auto &menu=Menu::get();
menu.actions["debug_stop"]->set_enabled(); menu.actions["debug_stop"]->set_enabled();
menu.actions["debug_kill"]->set_enabled(); menu.actions["debug_kill"]->set_enabled();
@ -279,7 +278,7 @@ void Project::Clang::debug_start() {
dispatcher.add([this, status] { dispatcher.add([this, status] {
debug_update_status(status); debug_update_status(status);
}); });
}, [this](const boost::filesystem::path &file_path, int line_nr, int line_index) { }, [this](const boost::filesystem::path &file_path, int line_nr, int line_index) {
dispatcher.add([this, file_path, line_nr, line_index] { dispatcher.add([this, file_path, line_nr, line_index] {
Project::debug_stop.first=file_path; Project::debug_stop.first=file_path;
Project::debug_stop.second.first=line_nr; Project::debug_stop.second.first=line_nr;

6
src/project.h

@ -21,9 +21,13 @@ public:
static std::atomic<bool> debugging; static std::atomic<bool> debugging;
static std::pair<boost::filesystem::path, std::pair<int, int> > debug_stop; static std::pair<boost::filesystem::path, std::pair<int, int> > debug_stop;
static void debug_update_stop(); static void debug_update_stop();
static std::unique_ptr<Gtk::Label> debug_status_label;
static void debug_update_status(const std::string &debug_status); static void debug_update_status(const std::string &debug_status);
static Gtk::Label &debug_status_label() {
static Gtk::Label label;
return label;
}
class Language { class Language {
public: public:
Language() {} Language() {}

8
src/window.cc

@ -26,8 +26,6 @@ Window::Window() : notebook(Notebook::get()) {
set_title("juCi++"); set_title("juCi++");
set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::SCROLL_MASK|Gdk::LEAVE_NOTIFY_MASK); set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::SCROLL_MASK|Gdk::LEAVE_NOTIFY_MASK);
Project::debug_status_label=std::unique_ptr<Gtk::Label>(new Gtk::Label());
set_menu_actions(); set_menu_actions();
configure(); configure();
@ -52,10 +50,10 @@ Window::Window() : notebook(Notebook::get()) {
info_and_status_hbox.pack_start(notebook.info, Gtk::PACK_SHRINK); info_and_status_hbox.pack_start(notebook.info, Gtk::PACK_SHRINK);
#if GTK_VERSION_GE(3, 12) #if GTK_VERSION_GE(3, 12)
info_and_status_hbox.set_center_widget(*Project::debug_status_label); info_and_status_hbox.set_center_widget(Project::debug_status_label());
#else #else
Project::debug_status_label->set_halign(Gtk::Align::ALIGN_CENTER); Project::debug_status_label().set_halign(Gtk::Align::ALIGN_CENTER);
info_and_status_hbox.pack_start(*Project::debug_status_label); info_and_status_hbox.pack_start(Project::debug_status_label());
#endif #endif
info_and_status_hbox.pack_end(notebook.status, Gtk::PACK_SHRINK); info_and_status_hbox.pack_end(notebook.status, Gtk::PACK_SHRINK);
terminal_vbox.pack_end(info_and_status_hbox, Gtk::PACK_SHRINK); terminal_vbox.pack_end(info_and_status_hbox, Gtk::PACK_SHRINK);

Loading…
Cancel
Save