mirror of https://gitlab.com/cppit/jucipp
44 changed files with 548 additions and 544 deletions
@ -0,0 +1,13 @@
|
||||
cmake_minimum_required (VERSION 2.8.4) |
||||
|
||||
set(project_name juci) |
||||
set(module juci_to_python_api) |
||||
|
||||
#### TODO WINDOWS SUPPORT #### |
||||
set(bin_install_path "/usr/local/bin") |
||||
set(lib_install_path "/usr/local/lib/python2.7/dist-packages/") |
||||
##### |
||||
|
||||
project (${project_name}) |
||||
|
||||
add_subdirectory("src") |
||||
@ -0,0 +1,22 @@
|
||||
# juCi++ |
||||
## Installation guide ## |
||||
Before installation, please install libclangmm see [installation guide](http://github.com/cppit/libclangmm/blob/master/docs/install.md) for installation. |
||||
## Debian |
||||
First dependencies: |
||||
```sh |
||||
$ sudo apt-get install libboost-python-dev libboost-filesystem-dev libboost-log-dev libboost-test-dev |
||||
libboost-thread-dev libboost-system-dev libgtkmm-3.0-dev libgtksourceview2.0-dev libgtksourceviewmm-3.0-dev |
||||
libpython-dev libclang-dev make cmake gcc |
||||
``` |
||||
Install the project: |
||||
```sh |
||||
$ git clone http://github.com/cppit/jucipp.git juci |
||||
$ cd juci |
||||
$ cmake . |
||||
$ make |
||||
$ sudo make install |
||||
``` |
||||
## Run |
||||
```sh |
||||
$ juci |
||||
``` |
||||
@ -1,164 +0,0 @@
|
||||
cmake_minimum_required (VERSION 2.8.4) |
||||
set(project_name juci) |
||||
set(module juci_to_python_api) |
||||
project (${project_name}) |
||||
add_definitions(-DBOOST_LOG_DYN_LINK) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -pthread -Wall -Wno-reorder") |
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/") |
||||
|
||||
#You are of course using Homebrew: |
||||
if(APPLE) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/opt/gettext/lib -I/usr/local/opt/gettext/include -undefined dynamic_lookup") #TODO: fix this |
||||
set(CMAKE_MACOSX_RPATH 1) |
||||
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig") |
||||
endif() |
||||
INCLUDE(FindPkgConfig) |
||||
|
||||
message("Searcing for libclang") |
||||
#LIBCLANG_FOUND System has libclang. |
||||
#LIBCLANG_INCLUDE_DIRS The libclang include directories. |
||||
#LIBCLANG_LIBRARIES The libraries needed to use libclang. |
||||
#LIBCLANG_LIBRARY_DIR The path to the directory containing libclang. |
||||
#LIBCLANG_KNOWN_LLVM_VERSIONS Known LLVM release numbers. |
||||
find_package(LibClangmm) |
||||
find_package(LibClang) |
||||
|
||||
if(${LCL_FOUND}) |
||||
message("libclangmm libraries found. Continuing") |
||||
message("${LCL_INCLUDE_DIRS}") |
||||
else() |
||||
message(FATAL_ERROR "The libclangmm libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
if(${LIBCLANG_FOUND}) |
||||
message("libclangmm libraries found. Continuing") |
||||
message("${LIBCLANG_INCLUDE_DIRS}") |
||||
else() |
||||
message(FATAL_ERROR "The libclangmm libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
#### Finding boost, the variables below is set ##### |
||||
#PYTHONLIBS_FOUND - True if headers and requested libraries were found |
||||
#PYTHON_INCLUDE_DIRS - Boost include directories |
||||
#PYTHON_LIBRARIES - Boost component libraries to be linked |
||||
find_package(PythonLibs 2.7) |
||||
|
||||
#If python is found |
||||
if(${PYTHONLIBS_FOUND}) |
||||
message("Python libraries found. Continuing") |
||||
else() |
||||
message("Please install python libraries. The libraries where not found.") |
||||
message("Python include dirs: ${PYTHON_INCLUDE_DIRS}") |
||||
message("Python link dirs ${PYTHON_LIBRARIES}") |
||||
message(FATAL_ERROR "The python libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
#### Finding boost, the variables below is set ##### |
||||
#Boost_FOUND - True if headers and requested libraries were found |
||||
#Boost_INCLUDE_DIRS - Boost include directories |
||||
#Boost_LIBRARY_DIRS - Link directories for Boost libraries |
||||
#Boost_LIBRARIES - Boost component libraries to be linked |
||||
find_package(Boost 1.55 COMPONENTS python thread log system filesystem REQUIRED) |
||||
|
||||
#If boost is not found |
||||
if(${Boost_FOUND}) |
||||
message("Boost libraries found. Continuing") |
||||
else() |
||||
message("Please install boost libraries. The libraries where not found.") |
||||
message("Boost library dirs: ${Boost_LIBRARY_DIRS}") |
||||
message("Boost include dirs: ${Boost_INCLUDE_DIRS}") |
||||
message("Boost link dirs ${Boost_LIBRARIES}") |
||||
message(FATAL_ERROR "The boost libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
#### Finding gtkmm, the variables below is set ##### |
||||
#GTKMM_FOUND - True if headers and requested libraries were found |
||||
#GTKMM_INCLUDE_DIRS - GTKMM include directories |
||||
#GTKMM_LIBRARY_DIRS - Link directories for GTKMM libraries |
||||
#GTKMM_LIBRARIES - GTKMM libraries to be linked |
||||
pkg_check_modules(GTKMM gtkmm-3.0) # The name GTKMM is set here for the variables abouve |
||||
|
||||
#If gtkmm is not found |
||||
if(${GTKMM_FOUND}) |
||||
message("Gtkmm libraries found. Continuing") |
||||
else() |
||||
message("Please install gtkmm libraries. The libraries where not found.") |
||||
message("Gtkmm library dirs ${GTKMM_LIBRARY_DIRS}") |
||||
message("Gtkmm include dirs ${GTKMM_INCLUDE_DIRS}") |
||||
message("Gtkmm link dirs ${GTKMM_LIBRARIES}") |
||||
message(FATAL_ERROR "The gtkmm libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
pkg_check_modules(GTKSVMM gtksourceviewmm-3.0) |
||||
if(${GTKSVMM_FOUND}) |
||||
message("Gtksourceviewmm libraries found. Continuing") |
||||
else() |
||||
message(FATAL_ERROR "The gtksourceviewmm libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
# name of the executable on Windows will be example.exe |
||||
add_executable(${project_name} |
||||
#list of every needed file to create the executable |
||||
juci.h |
||||
juci.cc |
||||
menu.h |
||||
menu.cc |
||||
source.h |
||||
source.cc |
||||
selectiondialog.h |
||||
selectiondialog.cc |
||||
config.h |
||||
config.cc |
||||
sourcefile.h |
||||
sourcefile.cc |
||||
window.cc |
||||
window.h |
||||
api.h |
||||
api.cc |
||||
notebook.cc |
||||
notebook.h |
||||
entrybox.h |
||||
entrybox.cc |
||||
directories.h |
||||
directories.cc |
||||
terminal.h |
||||
terminal.cc |
||||
tooltips.h |
||||
tooltips.cc |
||||
singletons.h |
||||
singletons.cc |
||||
) |
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
||||
|
||||
|
||||
add_library(${module} SHARED |
||||
api |
||||
api_ext |
||||
) |
||||
# dependencies |
||||
|
||||
include_directories( |
||||
${Boost_INCLUDE_DIRS} |
||||
${PYTHON_INCLUDE_DIRS} |
||||
${GTKMM_INCLUDE_DIRS} |
||||
${GTKSVMM_INCLUDE_DIRS} |
||||
${LCL_INCLUDE_DIRS} |
||||
${LIBCLANG_INCLUDE_DIRS} |
||||
) |
||||
link_directories( |
||||
${GTKMM_LIBRARY_DIRS} |
||||
${GTKSVMM_LIBRARY_DIRS} |
||||
${Boost_LIBRARY_DIRS} |
||||
${PYTHON_INCLUDE_DIRS} |
||||
${LCL_LIBRARY_DIRS} |
||||
${LIBCLANG_LIBRARY_DIRS} |
||||
) |
||||
#module: |
||||
set_target_properties(${module} PROPERTIES PREFIX "" |
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/") |
||||
target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) |
||||
#executable: |
||||
target_link_libraries(${project_name} ${LIVCLANG_LIBRARIES} ${LCL_LIBRARIES} ${GTKMM_LIBRARIES} ${GTKSVMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) |
||||
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
{ |
||||
"source": { |
||||
"colors": { |
||||
"text_color": "black", |
||||
"string": "#CC0000", |
||||
"namespace_ref": "#990099", |
||||
"type": "#0066FF", |
||||
"keyword": "blue", |
||||
"comment": "grey", |
||||
"own": "pink", |
||||
"diagnostic_warning": "orange", |
||||
"diagnostic_error": "red" |
||||
}, |
||||
"syntax": { |
||||
"43": "type", |
||||
"46": "namespace_ref", |
||||
"109": "string", |
||||
"702": "keyword", |
||||
"703": "own", |
||||
"705": "comment" |
||||
}, |
||||
"visual": { |
||||
"background": "white", |
||||
"background_selected": "blue", |
||||
"background_tooltips": "yellow", |
||||
"font": "Monospace", |
||||
"show_line_numbers": 1, |
||||
"highlight_current_line": 1 |
||||
}, |
||||
"tab_size": 2, |
||||
"tab_char": "<space>" |
||||
}, |
||||
"keybindings": { |
||||
"new_file": "<primary>n", |
||||
"open_folder": "<primary><alt>o", |
||||
"open_file": "<primary>o", |
||||
"save": "<primary>s", |
||||
"save_as": "<primary><shift>s", |
||||
"quit": "<primary>q", |
||||
"split_window": "<primary><alt>s", |
||||
"close_tab": "<primary>w", |
||||
"edit_copy": "<primary>c", |
||||
"edit_cut": "<primary>x", |
||||
"edit_paste": "<primary>v", |
||||
"edit_undo": "<primary>z", |
||||
"edit_redo": "<primary><shift>z", |
||||
"edit_find": "<primary>f", |
||||
"source_goto_declaration": "<primary>d", |
||||
"source_goto_method": "<primary>m", |
||||
"source_rename": "<primary>r", |
||||
"compile_and_run": "<primary>Return", |
||||
"compile": "<primary><shift>Return" |
||||
}, |
||||
"directoryfilter": { |
||||
"ignore": [ |
||||
"cmake", |
||||
"#", |
||||
"~", |
||||
".idea", |
||||
".so", |
||||
"in-lowercase.pls" |
||||
], |
||||
"exceptions": [ |
||||
"cmakelists.txt", |
||||
"in-lowercase.pls" |
||||
] |
||||
}, |
||||
"project": { |
||||
"run_commands": [ |
||||
"./.build/" |
||||
], |
||||
"compile_commands": [ |
||||
"rm -rf ./.build", |
||||
"mkdir ./.build", |
||||
"cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B./.build -H.", |
||||
"cd ./.build/; make", |
||||
"cp ./.build/compile_commands.json compile_commands.json" |
||||
] |
||||
}, |
||||
"example": { |
||||
"key": "value", |
||||
"key2": [ |
||||
"val1", |
||||
"val2", |
||||
3 |
||||
], |
||||
"key3": "value" |
||||
} |
||||
} |
||||
@ -1,40 +0,0 @@
|
||||
<ui> |
||||
<menubar name='MenuBar'> |
||||
<menu action='FileMenu'> |
||||
<menuitem action='FileNewFile'/> |
||||
<menuitem action='FileOpenFile'/> |
||||
<menuitem action='FileOpenFolder'/> |
||||
<menuitem action='FileSave'/> |
||||
<menuitem action='FileSaveAs'/> |
||||
<separator/> |
||||
<menuitem action='FileQuit'/> |
||||
</menu> |
||||
<menu action='EditMenu'> |
||||
<menuitem action='EditCopy'/> |
||||
<menuitem action='EditCut'/> |
||||
<menuitem action='EditPaste'/> |
||||
<separator/> |
||||
<menuitem action='EditFind'/> |
||||
<menuitem action='EditUndo'/> |
||||
<menuitem action='EditRedo'/> |
||||
</menu> |
||||
<menu action='SourceMenu'> |
||||
<menuitem action='SourceGotoDeclaration'/> |
||||
<menuitem action='SourceGotoMethod'/> |
||||
<menuitem action='SourceRename'/> |
||||
</menu> |
||||
<menu action='ProjectMenu'> |
||||
<menuitem action='ProjectCompileAndRun'/> |
||||
<menuitem action='ProjectCompile'/> |
||||
</menu> |
||||
<menu action='WindowMenu'> |
||||
<menuitem action='WindowCloseTab'/> |
||||
<menuitem action='WindowSplitWindow'/> |
||||
</menu> |
||||
<menu action='PluginMenu'> |
||||
</menu> |
||||
<menu action='HelpMenu'> |
||||
<menuitem action='HelpAbout'/> |
||||
</menu> |
||||
</menubar> |
||||
</ui> |
||||
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/python |
||||
#plugin handler |
||||
import sys, os, glob |
||||
cwd = os.getcwd() |
||||
sys.path.append(cwd+"/lib") |
||||
|
||||
import juci_to_python_api as juci |
||||
def loadplugins(): |
||||
plugin_files = glob.glob(cwd+"/plugins/*.py") |
||||
for current_file in plugin_files: |
||||
juci.initPlugin(current_file) |
||||
|
||||
loadplugins() |
||||
@ -1,92 +0,0 @@
|
||||
#include "sourcefile.h" |
||||
#include <giomm.h> |
||||
#include <string> |
||||
#include <iostream> |
||||
#include <vector> |
||||
|
||||
using namespace std; |
||||
|
||||
sourcefile::sourcefile(const string &input_filename) |
||||
: lines(), filename(input_filename) { |
||||
open(input_filename); |
||||
} |
||||
|
||||
/**
|
||||
*
|
||||
*/ |
||||
void sourcefile::open(const string &filename) { |
||||
Gio::init(); |
||||
|
||||
// Creates/Opens a file specified by the input string.
|
||||
Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(filename); |
||||
|
||||
if (!file) // Gio::File has overloaded operator
|
||||
cerr << "Was not able to open file: " << filename << endl; |
||||
|
||||
// Creates pointer for filestream
|
||||
|
||||
if (!file->query_exists()) { |
||||
file->create_file()->close(); |
||||
} |
||||
|
||||
Glib::RefPtr<Gio::FileInputStream> stream = file->read(); |
||||
|
||||
if (!stream) // error message on stream failure
|
||||
cerr << filename << " returned an empty stream" << endl; |
||||
|
||||
Glib::RefPtr<Gio::DataInputStream> |
||||
datainput = Gio::DataInputStream::create(stream); |
||||
|
||||
string line; |
||||
while (datainput->read_line(line)) { |
||||
lines.push_back(line); |
||||
} |
||||
|
||||
datainput->close(); |
||||
stream->close(); |
||||
} |
||||
|
||||
vector<string> sourcefile::get_lines() { |
||||
return lines; |
||||
} |
||||
|
||||
string sourcefile::get_line(int line_number) { |
||||
return lines[line_number]; |
||||
} |
||||
|
||||
int sourcefile::save(const string &text) { |
||||
Gio::init(); |
||||
|
||||
// Creates/Opens a file specified by the input string.
|
||||
Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(filename); |
||||
|
||||
if (!file) // Gio::File has overloaded operator
|
||||
cerr << "Was not able to open file: " << filename << endl; |
||||
|
||||
// Creates
|
||||
Glib::RefPtr<Gio::FileOutputStream> stream = |
||||
file->query_exists() ? file->replace() : file->create_file(); |
||||
|
||||
if (!stream) // error message on stream failure
|
||||
cerr << filename << " returned an empty stream" << endl; |
||||
|
||||
Glib::RefPtr<Gio::DataOutputStream> |
||||
output = Gio::DataOutputStream::create(stream); |
||||
|
||||
output->put_string(text); |
||||
|
||||
output->close(); |
||||
stream->close(); |
||||
|
||||
|
||||
return 0; |
||||
} |
||||
|
||||
string sourcefile::get_content() { |
||||
string res; |
||||
for (auto line : lines) { |
||||
res.append(line).append("\n"); |
||||
} |
||||
return res; |
||||
} |
||||
|
||||
@ -1,21 +0,0 @@
|
||||
#ifndef JUCI_SOURCEFILE_H_ |
||||
#define JUCI_SOURCEFILE_H_ |
||||
|
||||
#include <string> |
||||
#include <vector> |
||||
|
||||
class sourcefile { |
||||
public: |
||||
explicit sourcefile(const std::string &filename); |
||||
std::vector<std::string> get_lines(); |
||||
std::string get_content(); |
||||
std::string get_line(int line_number); |
||||
int save(const std::string &text); |
||||
|
||||
private: |
||||
void open(const std::string &filename); |
||||
std::vector<std::string> lines; |
||||
std::string filename; |
||||
}; |
||||
|
||||
#endif // JUCI_SOURCEFILE_H_
|
||||
@ -0,0 +1,123 @@
|
||||
add_definitions(-DBOOST_LOG_DYN_LINK) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -pthread -Wall -Wno-reorder") |
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/") |
||||
|
||||
if(APPLE) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/opt/gettext/lib -I/usr/local/opt/gettext/include -undefined dynamic_lookup") #T |
||||
set(CMAKE_MACOSX_RPATH 1) |
||||
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig") |
||||
endif() |
||||
INCLUDE(FindPkgConfig) |
||||
|
||||
set(validation true) |
||||
|
||||
function(install_help APPLE UNIX WINDOWS) |
||||
message("Install package with:") |
||||
if(UNIX) |
||||
if(APPLE) |
||||
message("brew install ${APPLE}") |
||||
else() |
||||
message("sudo apt-get install ${UNIX}") |
||||
endif(APPLE) |
||||
endif(UNIX) |
||||
if(WINDOWS) |
||||
message("choco install ${WINDOWS}") |
||||
endif(WINDOWS) |
||||
endfunction(install_help) |
||||
|
||||
function(validate FOUND APPLE UNIX WINDOWS) |
||||
if(!${FOUND}) |
||||
set(validation false) |
||||
install_help(${APPLE} ${UNIX} ${WINDOWS}) |
||||
endif() |
||||
endfunction(validate) |
||||
|
||||
find_package(LibClangmm) |
||||
validate(${LCL_FOUND} "clangmm" "clangmm" "clangmm") |
||||
|
||||
find_package(LibClang) |
||||
validate(${LIBCLANG_FOUND} "clang" "libclang-dev" "llvm") |
||||
|
||||
find_package(PythonLibs 2.7) |
||||
validate(${PYTHONLIBS_FOUND} "python" "libpython-dev" "python") |
||||
|
||||
find_package(Boost 1.55 COMPONENTS python thread log system filesystem REQUIRED) |
||||
validate(${Boost_FOUND} "boost" "libboost-all-dev" "boost") |
||||
|
||||
pkg_check_modules(GTKMM gtkmm-3.0) # The name GTKMM is set here for the variables abouve |
||||
validate(${GTKMM_FOUND} "gtkmm" "libgtkmm-dev" "gtkmm") |
||||
|
||||
pkg_check_modules(GTKSVMM gtksourceviewmm-3.0) |
||||
validate(${GTKSVMM_FOUND} "gtksvmm" "libgtksvmm-dev" "gtkmmsv") |
||||
|
||||
if(${validation}) |
||||
add_executable(${project_name} |
||||
juci.h |
||||
juci.cc |
||||
menu.h |
||||
menu.cc |
||||
source.h |
||||
source.cc |
||||
selectiondialog.h |
||||
selectiondialog.cc |
||||
config.h |
||||
config.cc |
||||
sourcefile.h |
||||
sourcefile.cc |
||||
window.cc |
||||
window.h |
||||
api.h |
||||
api.cc |
||||
notebook.cc |
||||
notebook.h |
||||
entrybox.h |
||||
entrybox.cc |
||||
directories.h |
||||
directories.cc |
||||
terminal.h |
||||
terminal.cc |
||||
tooltips.h |
||||
tooltips.cc |
||||
singletons.h |
||||
singletons.cc) |
||||
|
||||
add_library(${module} SHARED |
||||
api |
||||
api_ext) |
||||
|
||||
include_directories( |
||||
${Boost_INCLUDE_DIRS} |
||||
${PYTHON_INCLUDE_DIRS} |
||||
${GTKMM_INCLUDE_DIRS} |
||||
${GTKSVMM_INCLUDE_DIRS} |
||||
${LCL_INCLUDE_DIRS} |
||||
${LIBCLANG_INCLUDE_DIRS}) |
||||
|
||||
link_directories( |
||||
${GTKMM_LIBRARY_DIRS} |
||||
${GTKSVMM_LIBRARY_DIRS} |
||||
${Boost_LIBRARY_DIRS} |
||||
${PYTHON_INCLUDE_DIRS} |
||||
${LCL_LIBRARY_DIRS} |
||||
${LIBCLANG_LIBRARY_DIRS}) |
||||
|
||||
set_target_properties(${module} |
||||
PROPERTIES PREFIX "" |
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/") |
||||
|
||||
target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) |
||||
|
||||
target_link_libraries(${project_name} |
||||
${LIBCLANG_LIBRARIES} |
||||
${LCL_LIBRARIES} |
||||
${GTKMM_LIBRARIES} |
||||
${GTKSVMM_LIBRARIES} |
||||
${Boost_LIBRARIES} |
||||
${PYTHON_LIBRARIES}) |
||||
|
||||
install(TARGETS ${project_name} ${module} |
||||
RUNTIME DESTINATION ${bin_install_path} |
||||
LIBRARY DESTINATION ${lib_install_path} |
||||
) |
||||
endif(${validation}) |
||||
|
||||
@ -1,20 +1,15 @@
|
||||
# - Try to find LCL |
||||
|
||||
|
||||
# Once done this will define |
||||
# LCL_FOUND - Libclangmm is available |
||||
# LCL_INCLUDE_DIRS - The libclangmm include directories |
||||
# LCL_LIBRARIES - |
||||
# LCL_DEFINITIONS - Compiler switches required for using libclangmm |
||||
|
||||
find_package(PkgConfig) |
||||
|
||||
find_path(LCL_INCLUDE_DIR clangmm.h |
||||
HINTS "/usr/local/lib/libclangmm/include/" |
||||
HINTS "/usr/local/include/libclangmm/" |
||||
) |
||||
|
||||
find_library(LCL_LIBRARY NAMES clangmm |
||||
HINTS "/usr/local/lib/libclangmm/" |
||||
HINTS "/usr/local/lib/" |
||||
) |
||||
|
||||
set(LCL_LIBRARIES ${LCL_LIBRARY} ) |
||||
@ -0,0 +1,225 @@
|
||||
#include <string> |
||||
const std::string configjson = |
||||
"{\n" |
||||
" \"source\": {\n" |
||||
" \"colors\": {\n" |
||||
" \"text_color\": \"black\",\n" |
||||
" \"string\": \"#CC0000\",\n" |
||||
" \"namespace_ref\": \"#990099\",\n" |
||||
" \"type\": \"#0066FF\",\n" |
||||
" \"keyword\": \"blue\",\n" |
||||
" \"comment\": \"grey\",\n" |
||||
" \"own\": \"pink\",\n" |
||||
" \"diagnostic_warning\": \"orange\",\n" |
||||
" \"diagnostic_error\": \"red\"\n" |
||||
" },\n" |
||||
" \"syntax\": {\n" |
||||
" \"43\": \"type\",\n" |
||||
" \"46\": \"namespace_ref\",\n" |
||||
" \"109\": \"string\",\n" |
||||
" \"702\": \"keyword\",\n" |
||||
" \"703\": \"own\",\n" |
||||
" \"705\": \"comment\"\n" |
||||
" },\n" |
||||
" \"extensions\": [\n" |
||||
" \"c\",\n" |
||||
" \"cc\",\n" |
||||
" \"cpp\",\n" |
||||
" \"cxx\",\n" |
||||
" \"c++\",\n" |
||||
" \"h\",\n" |
||||
" \"hh\",\n" |
||||
" \"hpp\",\n" |
||||
" \"hxx\",\n" |
||||
" \"h++\"\n" |
||||
" ],\n" |
||||
" \"visual\": {\n" |
||||
" \"background\": \"white\",\n" |
||||
" \"background_selected\": \"blue\",\n" |
||||
" \"background_tooltips\": \"yellow\",\n" |
||||
" \"font\": \"Monospace\",\n" |
||||
" \"show_line_numbers\": 1,\n" |
||||
" \"highlight_current_line\": 1\n" |
||||
" },\n" |
||||
" \"tab_size\": 2,\n" |
||||
" \"tab_char\": \"<space>\"\n" |
||||
" },\n" |
||||
" \"keybindings\": {\n" |
||||
" \"new_file\": \"<primary>n\",\n" |
||||
" \"open_folder\": \"<primary><alt>o\",\n" |
||||
" \"open_file\": \"<primary>o\",\n" |
||||
" \"save\": \"<primary>s\",\n" |
||||
" \"save_as\": \"<primary><shift>s\",\n" |
||||
" \"quit\": \"<primary>q\",\n" |
||||
" \"split_window\": \"<primary><alt>s\",\n" |
||||
" \"close_tab\": \"<primary>w\",\n" |
||||
" \"edit_copy\": \"<primary>c\",\n" |
||||
" \"edit_cut\": \"<primary>x\",\n" |
||||
" \"edit_paste\": \"<primary>v\",\n" |
||||
" \"edit_undo\": \"<primary>z\",\n" |
||||
" \"edit_redo\": \"<primary><shift>z\",\n" |
||||
" \"edit_find\": \"<primary>f\",\n" |
||||
" \"source_goto_declaration\": \"<primary>d\",\n" |
||||
" \"source_goto_method\": \"<primary>m\",\n" |
||||
" \"source_rename\": \"<primary>r\",\n" |
||||
" \"compile_and_run\": \"<primary>Return\",\n" |
||||
" \"compile\": \"<primary><shift>Return\"\n" |
||||
" },\n" |
||||
" \"directoryfilter\": {\n" |
||||
" \"ignore\": [\n" |
||||
" \"cmake\",\n" |
||||
" \"#\",\n" |
||||
" \"~\",\n" |
||||
" \".idea\",\n" |
||||
" \".so\",\n" |
||||
" \"in-lowercase.pls\"\n" |
||||
" ],\n" |
||||
" \"exceptions\": [\n" |
||||
" \"cmakelists.txt\",\n" |
||||
" \"in-lowercase.pls\"\n" |
||||
" ]\n" |
||||
" },\n" |
||||
" \"project\": {\n" |
||||
" \"run_commands\": [\n" |
||||
" \"./.build/\"\n" |
||||
" ],\n" |
||||
" \"compile_commands\": [\n" |
||||
" \"rm -rf ./.build\",\n" |
||||
" \"mkdir ./.build\",\n" |
||||
" \"cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B./.build -H.\",\n" |
||||
" \"cd ./.build/; make\",\n" |
||||
" \"cp ./.build/compile_commands.json compile_commands.json\"\n" |
||||
" ]\n" |
||||
" },\n" |
||||
" \"example\": {\n" |
||||
" \"key\": \"value\",\n" |
||||
" \"key2\": [\n" |
||||
" \"val1\",\n" |
||||
" \"val2\",\n" |
||||
" 3\n" |
||||
" ],\n" |
||||
" \"key3\": \"value\"\n" |
||||
" }\n" |
||||
"}\n"; |
||||
|
||||
const std::string menuxml = |
||||
"<ui>\n" |
||||
" <menubar name=\"MenuBar\">\n" |
||||
" <menu action=\"FileMenu\">\n" |
||||
" <menuitem action=\"FileNewFile\"/>\n" |
||||
" <menuitem action=\"FileOpenFile\"/>\n" |
||||
" <menuitem action=\"FileOpenFolder\"/>\n" |
||||
" <menuitem action=\"FileSave\"/>\n" |
||||
" <menuitem action=\"FileSaveAs\"/>\n" |
||||
" <separator/>\n" |
||||
" <menuitem action=\"FileQuit\"/>\n" |
||||
" </menu>\n" |
||||
" <menu action=\"EditMenu\">\n" |
||||
" <menuitem action=\"EditCopy\"/>\n" |
||||
" <menuitem action=\"EditCut\"/>\n" |
||||
" <menuitem action=\"EditPaste\"/>\n" |
||||
" <separator/>\n" |
||||
" <menuitem action=\"EditFind\"/>\n" |
||||
" <menuitem action=\"EditUndo\"/>\n" |
||||
" <menuitem action=\"EditRedo\"/>\n" |
||||
" </menu>\n" |
||||
" <menu action=\"SourceMenu\">\n" |
||||
" <menuitem action=\"SourceGotoDeclaration\"/>\n" |
||||
" <menuitem action=\"SourceGotoMethod\"/>\n" |
||||
" <menuitem action=\"SourceRename\"/>\n" |
||||
" </menu>\n" |
||||
" <menu action=\"ProjectMenu\">\n" |
||||
" <menuitem action=\"ProjectCompileAndRun\"/>\n" |
||||
" <menuitem action=\"ProjectCompile\"/>\n" |
||||
" </menu>\n" |
||||
" <menu action=\"WindowMenu\">\n" |
||||
" <menuitem action=\"WindowCloseTab\"/>\n" |
||||
" <menuitem action=\"WindowSplitWindow\"/>\n" |
||||
" </menu>\n" |
||||
" <menu action=\"PluginMenu\">\n" |
||||
" </menu>\n" |
||||
" <menu action=\"HelpMenu\">\n" |
||||
" <menuitem action=\"HelpAbout\"/>\n" |
||||
" </menu>\n" |
||||
" </menubar>\n" |
||||
"</ui>\n"; |
||||
|
||||
const std::string pluginspy = |
||||
"#!/usr/bin/python \n" |
||||
"import juci_to_python_api as juci \n" |
||||
"import glob \n" |
||||
"\n" |
||||
"def loadplugins(): \n" |
||||
" plugin_files = glob.glob(\"../plugins/*.py\") \n" |
||||
" for current_file in plugin_files: \n" |
||||
" juci.initPlugin(current_file) \n" |
||||
"loadplugins() \n"; |
||||
|
||||
const std::string snippetpy = |
||||
"#!/usr/bin/python \n" |
||||
"#snippet plugin \n" |
||||
"import juci_to_python_api as juci, inspect \n" |
||||
" \n" |
||||
"def initPlugin(): \n" |
||||
" juci.addMenuElement(\"Snippet\") \n" |
||||
" juci.addSubMenuElement(\"SnippetMenu\", #name of parent menu \n" |
||||
" \"Insert snippet\", #menu description \n" |
||||
" \"insertSnippet()\", #function to execute \n" |
||||
" inspect.getfile(inspect.currentframe()), #plugin path \n" |
||||
" \"<control><alt>space\") \n" |
||||
"snippets = {} \n" |
||||
" \n" |
||||
"snippets[\"for\"] = \"\"\"\ \n" |
||||
"for(int i=0; i<v.size(); i++) { \n" |
||||
" // std::cout << v[i] << std::endl; \n" |
||||
" // Write code here \n" |
||||
"} \n" |
||||
"\"\"\" \n" |
||||
" \n" |
||||
"snippets[\"if\"] = \"\"\"\ \n" |
||||
"if(true) { \n" |
||||
" // Write code here \n" |
||||
"} \n" |
||||
"\"\"\" \n" |
||||
" \n" |
||||
"snippets[\"ifelse\"] = \"\"\"\ \n" |
||||
"if(false) { \n" |
||||
" // Write code here \n" |
||||
"} else { \n" |
||||
" // Write code here \n" |
||||
"} \n" |
||||
"\"\"\" \n" |
||||
" \n" |
||||
"snippets[\"while\"] = \"\"\"\ \n" |
||||
"while(condition) { \n" |
||||
" // Write code here \n" |
||||
"} \n" |
||||
"\"\"\" \n" |
||||
" \n" |
||||
"snippets[\"main\"] = \"\"\"\ \n" |
||||
"int main(int argc, char *argv[]) { \n" |
||||
" //Do something \n" |
||||
"} \n" |
||||
"\"\"\" \n" |
||||
" \n" |
||||
"snippets[\"hello\"] = \"\"\"\ \n" |
||||
"#include <iostream> \n" |
||||
" \n" |
||||
"int main(int argc, char *argv[]) { \n" |
||||
" std::cout << \"Hello, world! << std::endl; \n" |
||||
"} \n" |
||||
"\"\"\" \n" |
||||
" \n" |
||||
"def getSnippet(word): \n" |
||||
" try: \n" |
||||
" output = snippets[word] \n" |
||||
" except KeyError: \n" |
||||
" output = word \n" |
||||
" return output \n" |
||||
" \n" |
||||
"def insertSnippet(): \n" |
||||
" theWord=juci.getWord() \n" |
||||
" output=getSnippet(theWord) \n" |
||||
" juci.replaceWord(output) \n"; |
||||
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
#include "sourcefile.h" |
||||
#include <fstream> |
||||
|
||||
std::string juci::filesystem::open(std::string path) { |
||||
std::string res; |
||||
for (auto &line : lines(path)) { |
||||
res += line; |
||||
} |
||||
return res; |
||||
} |
||||
|
||||
std::vector<std::string> juci::filesystem::lines(std::string path) { |
||||
std::vector<std::string> res; |
||||
std::ifstream input(path); |
||||
if (input.is_open()) { |
||||
do { res.emplace_back(); } while(getline(input, res.back())); |
||||
} |
||||
input.close(); |
||||
return res; |
||||
} |
||||
|
||||
int juci::filesystem::save(std::string path, std::string new_content) { |
||||
std::ofstream output(path); |
||||
if(output.is_open()) { |
||||
output << new_content; |
||||
} else { |
||||
output.close(); |
||||
return 1; |
||||
} |
||||
output.close(); |
||||
return 0; |
||||
} |
||||
@ -0,0 +1,20 @@
|
||||
#ifndef JUCI_SOURCEFILE_H_ |
||||
#define JUCI_SOURCEFILE_H_ |
||||
#include <vector> |
||||
#include <string> |
||||
#include <boost/filesystem.hpp> |
||||
|
||||
namespace juci { |
||||
class filesystem { |
||||
public: |
||||
static std::string open(std::string); |
||||
static std::string open(boost::filesystem::path path) { return open(path.string()); } |
||||
static std::vector<std::string> lines(std::string); |
||||
static std::vector<std::string> lines(boost::filesystem::path path) { return lines(path.string()); }; |
||||
static int save(std::string, std::string); |
||||
static int save(boost::filesystem::path path, std::string new_content) { return save(path.string(), new_content); } |
||||
static int save(std::string path) { return save(path, ""); }; |
||||
static int save(boost::filesystem::path path) { return save(path, ""); }; |
||||
}; |
||||
} // namepace juci
|
||||
#endif // JUCI_SOURCEFILE_H_
|
||||
Loading…
Reference in new issue