Browse Source

Made debug_label static also

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

5
src/project.cc

@ -15,11 +15,10 @@ std::atomic<bool> Project::compiling;
std::atomic<bool> Project::debugging;
std::pair<boost::filesystem::path, std::pair<int, int> > Project::debug_stop;
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) {
if(debug_status.empty()) {
debug_status_label->set_text("");
debug_status_label().set_text("");
auto &menu=Menu::get();
menu.actions["debug_stop"]->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);
}
else {
debug_status_label->set_text("debug: "+debug_status);
debug_status_label().set_text("debug: "+debug_status);
auto &menu=Menu::get();
menu.actions["debug_stop"]->set_enabled();
menu.actions["debug_kill"]->set_enabled();

6
src/project.h

@ -21,9 +21,13 @@ public:
static std::atomic<bool> debugging;
static std::pair<boost::filesystem::path, std::pair<int, int> > debug_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 Gtk::Label &debug_status_label() {
static Gtk::Label label;
return label;
}
class Language {
public:
Language() {}

8
src/window.cc

@ -26,8 +26,6 @@ Window::Window() : notebook(Notebook::get()) {
set_title("juCi++");
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();
configure();
@ -52,10 +50,10 @@ Window::Window() : notebook(Notebook::get()) {
info_and_status_hbox.pack_start(notebook.info, Gtk::PACK_SHRINK);
#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
Project::debug_status_label->set_halign(Gtk::Align::ALIGN_CENTER);
info_and_status_hbox.pack_start(*Project::debug_status_label);
Project::debug_status_label().set_halign(Gtk::Align::ALIGN_CENTER);
info_and_status_hbox.pack_start(Project::debug_status_label());
#endif
info_and_status_hbox.pack_end(notebook.status, Gtk::PACK_SHRINK);
terminal_vbox.pack_end(info_and_status_hbox, Gtk::PACK_SHRINK);

Loading…
Cancel
Save