Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benoit Barbot
GraphEditor
Commits
bc1979b5
Commit
bc1979b5
authored
Oct 02, 2020
by
Benoit Barbot
Browse files
update
parent
bc15856e
Pipeline
#1732
failed with stage
in 6 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
TAEditor/Makefile.options
View file @
bc1979b5
...
...
@@ -11,9 +11,9 @@ SERVER_FILES := $(wildcard *.eliomi *.eliom)
CLIENT_FILES
:=
$(
wildcard
*
.eliomi
*
.eliom
)
TAGraph.ml
# OCamlfind packages for the server
SERVER_PACKAGES
:=
lwt.ppx
js_of_ocaml-ppx
.
deriving xml-light
SERVER_PACKAGES
:=
js_of_ocaml-ppx
_
deriving
_json
xml-light
# OCamlfind packages for the client
CLIENT_PACKAGES
:=
lwt.ppx
js_of_ocaml-ppx js_of_ocaml-ppx
.
deriving xml-light GraphEditor
CLIENT_PACKAGES
:=
js_of_ocaml-ppx js_of_ocaml-ppx
_
deriving
_json
xml-light GraphEditor
# Directory with files to be statically served
LOCAL_STATIC
=
static
...
...
TikzEditor/Makefile.options
View file @
bc1979b5
...
...
@@ -11,9 +11,9 @@ SERVER_FILES := $(wildcard *.eliomi *.eliom)
CLIENT_FILES
:=
$(
wildcard
*
.eliomi
*
.eliom
)
TikzGraph.ml MarkovChain.ml tikzLexer.ml tikzParser.ml
# OCamlfind packages for the server
SERVER_PACKAGES
:=
lwt_ppx js_of_ocaml-ppx
.
deriving xml-light
SERVER_PACKAGES
:=
lwt_ppx js_of_ocaml-ppx
_
deriving
_json
xml-light
# OCamlfind packages for the client
CLIENT_PACKAGES
:=
lwt_ppx js_of_ocaml-ppx js_of_ocaml-ppx
.
deriving xml-light GraphEditor
CLIENT_PACKAGES
:=
lwt_ppx js_of_ocaml-ppx js_of_ocaml-ppx
_
deriving
_json
xml-light GraphEditor
# Directory with files to be statically served
LOCAL_STATIC
=
static
...
...
editor/DrawingGeom.ml
View file @
bc1979b5
open
Js_of_ocaml
type
point
=
float
*
float
let
(
+..
)
(
x1
,
y1
)
(
x2
,
y2
)
=
...
...
editor/_oasis
View file @
bc1979b5
...
...
@@ -10,4 +10,4 @@ Library "GraphEditor"
BuildTools: ocamlbuild
Modules: Data, DrawingGeom, GenericSerializer, GraphDrawing, Layout,
SimpleGraph, UtilsWeb
BuildDepends: eliom.client,lwt_ppx,js_of_ocaml-ppx,js_of_ocaml-ppx
.
deriving,xml-light
BuildDepends: eliom.client,lwt_ppx,js_of_ocaml
,js_of_ocaml
-ppx,js_of_ocaml-ppx
_
deriving
_json,js_of_ocaml-lwt
,xml-light
editor/graphDrawing.ml
View file @
bc1979b5
open
Js_of_ocaml
type
node_type
=
int
module
type
GRAPH
=
sig
type
graph
...
...
@@ -77,7 +79,7 @@ module GraphEditor (G: GRAPH ) = struct
Js
.
Unsafe
.
fun_call
(
Js
.
Unsafe
.
js_expr
"upload"
)
[
|
Js
.
Unsafe
.
inject
f
;
Js
.
Unsafe
.
inject
id2
|
]
let
a_over
?
(
class_
=
""
)
?
(
on_mouse_over
=
fun
_
->
()
)
value
=
let
input2
=
Raw
.
a
~
a
:
[
a_href
""
]
[
pcdata
value
]
in
let
input2
=
Raw
.
a
~
a
:
[
a_href
""
]
[
txt
value
]
in
let
input
=
Eliom_content
.
Html
.
To_dom
.
of_a
input2
in
let
on_input
_
=
on_mouse_over
input
;
Js
.
_true
in
input
##.
onclick
:=
Dom
.
handler
on_input
;
...
...
@@ -305,7 +307,7 @@ module GraphEditor (G: GRAPH ) = struct
let
string_value
=
Format
.
asprintf
"%a"
df
s
.
graph
in
download
string_value
fn
"data:application/xml"
))
G
.
print_graph
)
in
div
[
p
[
pcdata
"Load file: "
;
div
[
p
[
txt
"Load file: "
;
input
~
a
:
[
a_id
"filein"
;
a_input_type
`File
;
a_onchange
(
change_file
loadfile
)]
()
;
choice_input
~
init_value
:
(
Some
"Download"
)
~
on_change
:
(
fun
x
->
(
List
.
assoc
x
dl
)
()
)
(
List
.
map
(
fst
)
dl
);
...
...
@@ -316,7 +318,7 @@ module GraphEditor (G: GRAPH ) = struct
let string_value = get_exchange_string s.graph in
download string_value "graph.gex" "data:application/xml") ]
[pcdata "Get GEX"];*)
button
~
a
:
[
a_onclick
(
fun
_
->
layout_graph
s
;
draw
s
(
0
.
0
,
0
.
0
))]
[
pcdata
"Layout Graph"
];
button
~
a
:
[
a_onclick
(
fun
_
->
layout_graph
s
;
draw
s
(
0
.
0
,
0
.
0
))]
[
txt
"Layout Graph"
];
update_link
"Direct Link"
(
fun
n
->
(
n
^
"?q="
^
(
get_exchange_string
s
.
graph
)))
]]
...
...
@@ -429,27 +431,27 @@ let rec html_of_attr s attr nattr cb =
(
id
,
n
,
v
)
->
let
delbutton
=
(
button
~
a
:
[
a_onclick
(
callback_supr
id
)]
[
(*span ~a:[a_class ["glyphicon";"glyphicon-remove"]] [];*)
pcdata
"X"
])
in
(*span ~a:[a_class ["glyphicon";"glyphicon-remove"]] [];*)
txt
"X"
])
in
match
v
with
|
`ControlPoint
(
x
,
y
)
->
tr
[
td
[
pcdata
n
;
pcdata
(
Printf
.
sprintf
": (%g,%g)"
x
y
);
];
tr
[
td
[
txt
n
;
txt
(
Printf
.
sprintf
": (%g,%g)"
x
y
);
];
td
[
];
td
[
delbutton
]
]
|
`Choice
((
str
::_
)
as
l
)
->
tr
[
td
[
pcdata
n
;
pcdata
": "
;
];
tr
[
td
[
txt
n
;
txt
": "
;
];
td
[
choice_input
~
on_change
:
(
fun
nv
->
ignore
@@
callback
id
v
nv
)
l
];
td
[
delbutton
]]
|
`Choice
[]
->
tr
[]
|
`String
str
->
tr
[
td
[
pcdata
n
;
pcdata
": "
;
];
tr
[
td
[
txt
n
;
txt
": "
;
];
td
[
text_input
~
on_change
:
(
callback
id
v
)
str
];
td
[
delbutton
]]
|
`Color
str
->
tr
[
td
[
pcdata
n
;
pcdata
": "
;
];
tr
[
td
[
txt
n
;
txt
": "
;
];
td
[
color_input
~
on_change
:
(
callback
id
v
)
str
];
td
[
delbutton
]]
)
attr
in
...
...
@@ -472,7 +474,7 @@ let rec html_of_attr s attr nattr cb =
let
a
=
Dom
.
list_of_nodeList
s
.
attribute_list
##.
childNodes
in
List
.
iter
(
fun
x
->
Dom
.
removeChild
s
.
attribute_list
x
)
a
;
let
divat
=
div
[
pcdata
name
]
in
let
divat
=
div
[
txt
name
]
in
Dom
.
appendChild
s
.
attribute_list
(
Eliom_content
.
Html
.
To_dom
.
of_div
(
divat
));
...
...
@@ -510,7 +512,7 @@ let rec html_of_attr s attr nattr cb =
set_selected
s
Empty
(
0
.
0
,
0
.
0
)
in
Dom
.
appendChild
s
.
attribute_list
(
Eliom_content
.
Html
.
To_dom
.
of_button
(
button
~
a
:
[
a_style
"float:right"
;
a_onclick
suprcb
]
[
pcdata
"Delete"
]))
(
Eliom_content
.
Html
.
To_dom
.
of_button
(
button
~
a
:
[
a_style
"float:right"
;
a_onclick
suprcb
]
[
txt
"Delete"
]))
...
...
@@ -519,7 +521,7 @@ let rec html_of_attr s attr nattr cb =
draw
s
(
0
.
0
,
0
.
0
);
let
open
Eliom_lib
in
let
open
Lwt_js_events
in
let
open
Js_of_ocaml_lwt
.
Lwt_js_events
in
let
osobj
=
ref
Empty
in
Lwt
.
async
(
fun
()
->
Lwt
.
pick
[
...
...
editor/utilsWeb.ml
View file @
bc1979b5
open
Js_of_ocaml
open
Eliom_content
.
Html
.
D
let
text_input
?
(
class_
=
""
)
?
(
on_change
=
fun
_
->
true
)
value
=
...
...
@@ -14,7 +15,7 @@ let text_input ?(class_ = "") ?(on_change = fun _ -> true) value =
input2
let
update_link
n
f
=
let
link
=
Raw
.
a
~
a
:
[
a_href
"#"
]
[
pcdata
n
]
in
let
link
=
Raw
.
a
~
a
:
[
a_href
"#"
]
[
txt
n
]
in
let
domlink
=
Eliom_content
.
Html
.
To_dom
.
of_a
link
in
let
currref
=
Js
.
to_string
Dom_html
.
window
##.
location
##.
href
in
domlink
##.
onmouseover
:=
Dom
.
handler
(
fun
_
->
...
...
@@ -24,10 +25,10 @@ let update_link n f =
link
let
choice_input
?
(
class_
=
""
)
?
(
on_change
=
fun
_
->
()
)
?
(
init_value
=
None
)
option_list
=
let
choice_list
=
List
.
map
(
fun
x
->
option
(
pcdata
(
">"
^
x
)))
option_list
in
let
choice_list
=
List
.
map
(
fun
x
->
option
(
txt
(
">"
^
x
)))
option_list
in
let
input2
=
select
(
match
init_value
with
|
None
->
choice_list
|
Some
iv
->
(
option
(
pcdata
iv
))
::
choice_list
)
in
|
Some
iv
->
(
option
(
txt
iv
))
::
choice_list
)
in
let
input
=
Eliom_content
.
Html
.
To_dom
.
of_select
input2
in
let
on_input
_
=
let
v
=
Js
.
to_string
input
##.
value
in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment