Browse Source

Added debug options popover to Debug Set Run Arguments menu item. Related to #238

merge-requests/365/head
Ole Christian Eidheim 10 years ago
parent
commit
6c4b3366e7
  1. 14
      src/project.cc
  2. 12
      src/project.h
  3. 11
      src/window.cc

14
src/project.cc

@ -18,6 +18,7 @@ std::atomic<bool> Project::compiling(false);
std::atomic<bool> Project::debugging(false); std::atomic<bool> Project::debugging(false);
std::pair<boost::filesystem::path, std::pair<int, int> > Project::debug_stop; std::pair<boost::filesystem::path, std::pair<int, int> > Project::debug_stop;
std::unique_ptr<Project::Base> Project::current; std::unique_ptr<Project::Base> Project::current;
std::unordered_map<std::string, Project::Clang::DebugOptionsPopover> Project::Clang::debug_options_popovers;
Gtk::Label &Project::debug_status_label() { Gtk::Label &Project::debug_status_label() {
static Gtk::Label label; static Gtk::Label label;
@ -153,6 +154,13 @@ void Project::Base::debug_start() {
Info::get().print("Could not find a supported project"); Info::get().print("Could not find a supported project");
} }
Project::Clang::DebugOptionsPopover::DebugOptionsPopover() : Gtk::Popover() {
hbox.pack_start(test, true, true);
add(hbox);
show_all();
set_visible(false);
}
std::pair<std::string, std::string> Project::Clang::get_run_arguments() { std::pair<std::string, std::string> Project::Clang::get_run_arguments() {
auto build_path=build->get_default_path(); auto build_path=build->get_default_path();
if(build_path.empty()) if(build_path.empty())
@ -266,6 +274,12 @@ std::pair<std::string, std::string> Project::Clang::debug_get_run_arguments() {
return {project_path, arguments}; return {project_path, arguments};
} }
Gtk::Popover *Project::Clang::debug_get_options_popover() {
if(!build->project_path.empty())
return &debug_options_popovers[build->project_path.string()];
return nullptr;
}
void Project::Clang::debug_start() { void Project::Clang::debug_start() {
auto debug_build_path=build->get_debug_path(); auto debug_build_path=build->get_debug_path();
if(debug_build_path.empty() || !build->update_debug()) if(debug_build_path.empty() || !build->update_debug())

12
src/project.h

@ -37,6 +37,7 @@ namespace Project {
virtual void compile_and_run(); virtual void compile_and_run();
virtual std::pair<std::string, std::string> debug_get_run_arguments(); virtual std::pair<std::string, std::string> debug_get_run_arguments();
virtual Gtk::Popover *debug_get_options_popover() { return nullptr; }
Tooltips debug_variable_tooltips; Tooltips debug_variable_tooltips;
virtual void debug_start(); virtual void debug_start();
virtual void debug_continue() {} virtual void debug_continue() {}
@ -56,7 +57,15 @@ namespace Project {
}; };
class Clang : public Base { class Clang : public Base {
private: class DebugOptionsPopover : public Gtk::Popover {
public:
DebugOptionsPopover();
private:
Gtk::HBox hbox;
Gtk::Label test=Gtk::Label("Not yet implemented");
};
static std::unordered_map<std::string, DebugOptionsPopover> debug_options_popovers;
Dispatcher dispatcher; Dispatcher dispatcher;
public: public:
Clang(std::unique_ptr<Build> &&build) : Base(std::move(build)) {} Clang(std::unique_ptr<Build> &&build) : Base(std::move(build)) {}
@ -69,6 +78,7 @@ namespace Project {
std::mutex debug_start_mutex; std::mutex debug_start_mutex;
#ifdef JUCI_ENABLE_DEBUG #ifdef JUCI_ENABLE_DEBUG
std::pair<std::string, std::string> debug_get_run_arguments() override; std::pair<std::string, std::string> debug_get_run_arguments() override;
Gtk::Popover *debug_get_options_popover() override;
void debug_start() override; void debug_start() override;
void debug_continue() override; void debug_continue() override;
void debug_stop() override; void debug_stop() override;

11
src/window.cc

@ -718,6 +718,17 @@ void Window::set_menu_actions() {
}, 50); }, 50);
auto entry_it=EntryBox::get().entries.begin(); auto entry_it=EntryBox::get().entries.begin();
entry_it->set_placeholder_text("Debug: Set Run Arguments"); entry_it->set_placeholder_text("Debug: Set Run Arguments");
if(auto options_popover=project->debug_get_options_popover()) {
EntryBox::get().buttons.emplace_back("", [this, options_popover]() {
options_popover->set_visible(true);
});
EntryBox::get().buttons.back().set_image_from_icon_name("preferences-system");
EntryBox::get().buttons.back().set_always_show_image(true);
EntryBox::get().buttons.back().set_tooltip_text("Additional Options");
options_popover->set_relative_to(EntryBox::get().buttons.back());
}
EntryBox::get().buttons.emplace_back("Debug: set run arguments", [this, entry_it](){ EntryBox::get().buttons.emplace_back("Debug: set run arguments", [this, entry_it](){
entry_it->activate(); entry_it->activate();
}); });

Loading…
Cancel
Save