From e63698bfd390eba595aa5b402c4b9a7f95acf731 Mon Sep 17 00:00:00 2001 From: Jonathan Bieler Date: Wed, 1 Jan 2020 15:11:14 +0100 Subject: [PATCH] added basic documentation --- README.md | 6 +--- docs/.gitignore | 2 ++ docs/Project.toml | 2 ++ docs/make.jl | 15 ++++++++ docs/src/index.md | 53 +++++++++++++++++++++++++++ src/GtkSourceWidget.jl | 82 +++++++++++++++++++++++++++++++++++------- 6 files changed, 143 insertions(+), 17 deletions(-) create mode 100644 docs/.gitignore create mode 100644 docs/Project.toml create mode 100644 docs/make.jl create mode 100644 docs/src/index.md diff --git a/README.md b/README.md index 145070d..668f281 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # GtkSourceWidget -[![Build Status](https://travis-ci.org/tknopp/GtkSourceWidget.jl.svg?branch=master)](https://travis-ci.org/tknopp/GtkSourceWidget.jl) +[![Build Status](https://travis-ci.com/JuliaGtk/GtkSourceWidget.jl.svg?branch=master)](https://travis-ci.com/JuliaGtk/GtkSourceWidget.jl) [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://pkg.julialang.org/docs/GtkSourceWidget/) GtkSourceWidget.jl is a Julia wrapper for the Gtk library GtkSourceView that allows showing source code documents (see https://wiki.gnome.org/Projects/GtkSourceView). - -## Installation - - ]dev https://github.com/JuliaGtk/GtkSourceWidget.jl.git diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..a303fff --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +build/ +site/ diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..dfa65cd --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,2 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..f19aa28 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,15 @@ +using Documenter +using GtkSourceWidget + +makedocs( + sitename = "GtkSourceWidget", + format = Documenter.HTML(), + modules = [GtkSourceWidget] +) + +# Documenter can also automatically deploy documentation to gh-pages. +# See "Hosting Documentation" and deploydocs() in the Documenter manual +# for more information. +#=deploydocs( + repo = "" +)=# diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..d6730ac --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,53 @@ +# GtkSourceWidget.jl + +GtkSourceWidget.jl is a Julia wrapper for the Gtk library GtkSourceView that allows showing source code documents (see [https://wiki.gnome.org/Projects/GtkSourceView](https://wiki.gnome.org/Projects/GtkSourceView) ). + +Some methods are not yet documented, and others are not implemented. Browsing the source file is recommended. + +## Index + +```@index +Pages = ["index.md"] +``` + +## Basic usage + +```julia +using Gtk, GtkSourceWidget + +w = GtkWindow() +b = GtkSourceBuffer() +b.text[String] = "test" +v = GtkSourceView(b) +push!(w,v) +showall(w) +``` + +## Types + +```julia +GtkSourceBuffer +GtkSourceView +GtkSourceLanguage +GtkSourceLanguageManager +GtkSourceStyle +GtkSourceStyleScheme +GtkSourceStyleSchemeManager +GtkSourceSearchSettings +GtkSourceSearchContext +GtkSourceMap +``` + +## Public Interface + +```@autodocs +Modules = [GtkSourceWidget] +Private = false +``` + +## Internals + +```@autodocs +Modules = [GtkSourceWidget] +Public = true +``` \ No newline at end of file diff --git a/src/GtkSourceWidget.jl b/src/GtkSourceWidget.jl index 0b332d9..336d919 100644 --- a/src/GtkSourceWidget.jl +++ b/src/GtkSourceWidget.jl @@ -39,19 +39,23 @@ end get_search_path(manager::GtkSourceLanguageManager) = ccall((:gtk_source_language_manager_get_search_path,libgtksourceview),Ptr{Ptr{UInt8}}, (Ptr{GObject},),manager) +""" + set_search_path(manager::GtkSourceLanguageManager, dir) - # 3-element Array{Ptr{UInt8},1}: - # Ptr{UInt8} @0x000000001bb85ac0 - # Ptr{UInt8} @0x000000001bb84e70 - # Ptr{UInt8} @0x0000000000000000 - # - # julia> bytestring(pointer_to_array(p,2)[1]) +Implements `gtk_source_language_manager_set_search_path`. -set_search_path(manager::GtkSourceLanguageManager,dir) = ccall((:gtk_source_language_manager_set_search_path,libgtksourceview),Nothing, +Example : + `GtkSourceWidget.set_search_path(sourceStyleManager, Any[path, C_NULL])` +""" +set_search_path(manager::GtkSourceLanguageManager, dir) = ccall((:gtk_source_language_manager_set_search_path,libgtksourceview),Nothing, (Ptr{GObject}, Ptr{Ptr{UInt8}}),manager, dir) -# Use: GtkSourceWidget.set_search_path(m,Any["c:/ad","yp",C_NULL]) +""" + language(manager::GtkSourceLanguageManager, id::String) + +Implements `gtk_source_language_manager_get_language`. +""" language(manager::GtkSourceLanguageManager, id::String) = GtkSourceLanguage( ccall((:gtk_source_language_manager_get_language,libgtksourceview),Ptr{GObject}, (Ptr{GObject},Ptr{UInt8}),manager,string(id))) @@ -64,7 +68,11 @@ Gtk.@Gtype GtkSourceStyle libgtksourceview gtk_source_style Gtk.@Gtype GtkSourceStyleScheme libgtksourceview gtk_source_style_scheme +""" + style(scheme::GtkSourceStyleScheme, style_id::String) +Implements `gtk_source_style_scheme_get_style`. +""" style(scheme::GtkSourceStyleScheme, style_id::String) = GtkSourceStyle( ccall((:gtk_source_style_scheme_get_style,libgtksourceview),Ptr{GObject}, (Ptr{GObject}, Ptr{UInt8}), scheme, string(style_id))) @@ -75,18 +83,28 @@ Gtk.@Gtype GtkSourceStyleSchemeManager libgtksourceview gtk_source_style_scheme_ function GtkSourceStyleSchemeManagerLeaf(default=true) if default GtkSourceStyleSchemeManagerLeaf( - ccall((:gtk_source_style_scheme_manager_get_default,libgtksourceview),Ptr{GObject},())) + ccall((:gtk_source_style_scheme_manager_get_default, libgtksourceview), Ptr{GObject},())) else GtkSourceStyleSchemeManagerLeaf( - ccall((:gtk_source_style_scheme_manager_get_new,libgtksourceview),Ptr{GObject},())) + ccall((:gtk_source_style_scheme_manager_get_new, libgtksourceview), Ptr{GObject},())) end end +""" + style_scheme(manager::GtkSourceStyleSchemeManager, scheme_id::String) + +Implements `gtk_source_style_scheme_manager_get_scheme`. +""" style_scheme(manager::GtkSourceStyleSchemeManager, scheme_id::String) = GtkSourceStyleScheme( ccall((:gtk_source_style_scheme_manager_get_scheme,libgtksourceview),Ptr{GObject}, (Ptr{GObject},Ptr{UInt8}),manager,string(scheme_id))) -set_search_path(manager::GtkSourceStyleSchemeManager,dir) = ccall((:gtk_source_style_scheme_manager_set_search_path,libgtksourceview),Nothing, +""" + set_search_path(manager::GtkSourceStyleSchemeManager, dir) + +Implements `gtk_source_style_scheme_manager_set_search_path`. +""" +set_search_path(manager::GtkSourceStyleSchemeManager, dir) = ccall((:gtk_source_style_scheme_manager_set_search_path,libgtksourceview),Nothing, (Ptr{GObject}, Ptr{Ptr{UInt8}}),manager, dir) ### GtkSourceUndoManager @@ -116,18 +134,38 @@ Gtk.@Gtype GtkSourceBuffer libgtksourceview gtk_source_buffer GtkSourceBufferLeaf() = GtkSourceBufferLeaf( ccall((:gtk_source_buffer_new,libgtksourceview),Ptr{GObject}, (Ptr{Nothing},), C_NULL) ) +""" + GtkSourceBuffer(lang::GtkSourceLanguage) + +Implements `gtk_source_buffer_new_with_language`. +""" GtkSourceBufferLeaf(lang::GtkSourceLanguage) = GtkSourceBufferLeaf( - ccall((:gtk_source_buffer_new_with_language,libgtksourceview),Ptr{GObject}, + ccall((:gtk_source_buffer_new_with_language, libgtksourceview), Ptr{GObject}, (Ptr{GObject},), lang) ) +""" + highlight_syntax(buffer::GtkSourceBuffer, highlight::Bool) + +Implements `gtk_source_buffer_set_highlight_syntax`. +""" highlight_syntax(buffer::GtkSourceBuffer, highlight::Bool) = ccall((:gtk_source_buffer_set_highlight_syntax,libgtksourceview),Ptr{GObject}, (Ptr{GObject},Cint),buffer,Int32(highlight)) +""" + highlight_matching_brackets(buffer::GtkSourceBuffer, highlight::Bool) + +Implements `gtk_source_buffer_set_highlight_matching_brackets`. +""" highlight_matching_brackets(buffer::GtkSourceBuffer, highlight::Bool) = ccall((:gtk_source_buffer_set_highlight_matching_brackets,libgtksourceview),Ptr{GObject}, (Ptr{GObject},Cint),buffer,Int32(highlight)) +""" + style_scheme!(buffer::GtkSourceBuffer, scheme::GtkSourceStyleScheme) + +Implements `gtk_source_buffer_set_style_scheme`. +""" style_scheme!(buffer::GtkSourceBuffer, scheme::GtkSourceStyleScheme) = ccall((:gtk_source_buffer_set_style_scheme,libgtksourceview),Nothing, (Ptr{GObject},Ptr{GObject}),buffer,scheme) @@ -140,10 +178,20 @@ max_undo_levels!(buffer::GtkSourceBuffer, levels::Integer) = ccall((:gtk_source_buffer_set_max_undo_levels,libgtksourceview),Nothing, (Ptr{GObject},Cint),buffer,levels) +""" + undo!(buffer::GtkSourceBuffer) + +Implements `gtk_source_buffer_undo`. +""" undo!(buffer::GtkSourceBuffer) = ccall((:gtk_source_buffer_undo,libgtksourceview),Nothing, (Ptr{GObject},),buffer) +""" + redo!(buffer::GtkSourceBuffer) + +Implements `gtk_source_buffer_redo`. +""" redo!(buffer::GtkSourceBuffer) = ccall((:gtk_source_buffer_redo,libgtksourceview),Nothing, (Ptr{GObject},),buffer) @@ -171,6 +219,11 @@ GtkSourceViewLeaf(buffer=GtkSourceBuffer()) = GtkSourceView( ccall((:gtk_source_view_new_with_buffer,libgtksourceview),Ptr{GObject},(Ptr{GObject},),buffer)) +""" + show_line_numbers!(view::GtkSourceView, show::Bool) + +Implements `gtk_source_view_set_show_line_numbers`. +""" show_line_numbers!(view::GtkSourceView, show::Bool) = ccall((:gtk_source_view_set_show_line_numbers,libgtksourceview),Nothing, (Ptr{GObject},Cint),view,Int32(show)) @@ -179,6 +232,11 @@ auto_indent!(view::GtkSourceView, auto::Bool) = ccall((:gtk_source_view_set_auto_indent,libgtksourceview),Nothing, (Ptr{GObject},Cint),view,Int32(auto)) +""" + highlight_current_line!(view::GtkSourceView, hl::Bool) + +Implements `gtk_source_view_set_highlight_current_line`. +""" highlight_current_line!(view::GtkSourceView, hl::Bool) = ccall((:gtk_source_view_set_highlight_current_line,libgtksourceview),Nothing, (Ptr{GObject},Cint),view,Int32(hl))