Browse Source

Fixed builds without lldb, added HTML project, and fixed opening web-pages on non-OS X systems

merge-requests/365/head
eidheim 10 years ago
parent
commit
ad14337aea
  1. 2
      src/notebook.cc
  2. 21
      src/project.cc
  3. 11
      src/project.h

2
src/notebook.cc

@ -362,6 +362,8 @@ std::unique_ptr<Project> Notebook::get_project() {
return std::unique_ptr<Project>(new ProjectPython(*this));
if(get_current_view()->language->get_id()=="js")
return std::unique_ptr<Project>(new ProjectJavaScript(*this));
if(get_current_view()->language->get_id()=="html")
return std::unique_ptr<Project>(new ProjectHTML(*this));
}
return std::unique_ptr<Project>(new ProjectClang(*this));

21
src/project.cc

@ -407,7 +407,15 @@ void ProjectMarkdown::compile_and_run() {
std::ofstream file_stream(temp_path.string(), std::fstream::binary);
file_stream << stdout_stream.rdbuf();
file_stream.close();
Terminal::get().async_process("open "+temp_path.string());
auto uri=temp_path.string();
#ifdef __APPLE__
Terminal::get().process("open \""+uri+"\"");
#else
GError* error=NULL;
gtk_show_uri(NULL, uri.c_str(), GDK_CURRENT_TIME, &error);
g_clear_error(&error);
#endif
}
}
}
@ -428,3 +436,14 @@ void ProjectJavaScript::compile_and_run() {
Terminal::get().async_print(command+" returned: "+std::to_string(exit_status)+'\n');
});
}
void ProjectHTML::compile_and_run() {
auto uri=notebook.get_current_view()->file_path.string();
#ifdef __APPLE__
Terminal::get().process("open \""+uri+"\"");
#else
GError* error=NULL;
gtk_show_uri(NULL, uri.c_str(), GDK_CURRENT_TIME, &error);
g_clear_error(&error);
#endif
}

11
src/project.h

@ -53,8 +53,9 @@ public:
void compile() override;
void compile_and_run() override;
std::pair<std::string, std::string> debug_get_run_arguments() override;
std::mutex debug_start_mutex;
#ifdef JUCI_ENABLE_DEBUG
std::pair<std::string, std::string> debug_get_run_arguments() override;
void debug_start(std::function<void(const std::string &status)> status_callback,
std::function<void(const boost::filesystem::path &file_path, int line_nr, int line_index)> stop_callback) override;
void debug_continue() override;
@ -67,6 +68,7 @@ public:
void debug_show_variables() override;
void debug_run_command(const std::string &command) override;
void debug_delete() override;
#endif
};
class ProjectMarkdown : public Project {
@ -92,4 +94,11 @@ public:
void compile_and_run() override;
};
class ProjectHTML : public Project {
public:
ProjectHTML(Notebook &notebook) : Project(notebook) {}
void compile_and_run() override;
};
#endif // JUCI_PROJECT_H_

Loading…
Cancel
Save