Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/gui #59

Open
wants to merge 143 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
7db3ba9
wip gui
thorstink Nov 26, 2023
e9494bb
wip gui
thorstink Nov 29, 2023
70e849f
new gui attempt
thorstink Dec 8, 2023
89633a3
wip2
thorstink Dec 18, 2023
de332ae
o
thorstink Dec 22, 2023
149ac36
adding stuff
thorstink Dec 26, 2023
5c7fb56
naming stuff
thorstink Dec 27, 2023
773327d
naming stuff
thorstink Dec 27, 2023
0108dd2
olayout + directed arrows
thorstink Dec 28, 2023
93c6511
highlight
thorstink Jan 6, 2024
920575e
highlight
thorstink Jan 6, 2024
d993aff
some const
thorstink Jan 6, 2024
b7b1299
some const
thorstink Jan 6, 2024
32ff3b4
some view
thorstink Jan 6, 2024
489c388
remove stuff
thorstink Jan 7, 2024
0c3fcfc
remove nodes
thorstink Jan 7, 2024
6fef5d7
remove arcs
thorstink Jan 9, 2024
ced0213
govis colors
thorstink Jan 10, 2024
a121983
git wips mooi
thorstink Jan 12, 2024
9a11b21
rxcpp!
thorstink Jan 12, 2024
c9c99ef
flux...
thorstink Jan 16, 2024
9d7d5bd
no more auto layout
thorstink Jan 19, 2024
e2daeac
pretty
thorstink Jan 19, 2024
bc596a6
pretty
thorstink Jan 19, 2024
0792233
pretty
thorstink Jan 30, 2024
53792e7
color mystery solved
thorstink Feb 7, 2024
62b8bd2
rpp++ v2
thorstink May 11, 2024
bc0ed35
refactorwith renderers
thorstink May 11, 2024
4c3c385
wip
thorstink May 11, 2024
022cf79
rpp
thorstink May 11, 2024
7069e7b
we
thorstink May 11, 2024
70fcc4d
&&&
thorstink May 11, 2024
34d375e
more
thorstink May 11, 2024
f5c5a44
towards viewmodel
thorstink May 13, 2024
c81bca2
wip hover
thorstink May 17, 2024
9a06a30
deprecat graph
thorstink May 21, 2024
ed287bf
remove transitions or places
thorstink May 23, 2024
8be3372
oops
thorstink May 23, 2024
016cfcf
move file browser away from model
thorstink May 23, 2024
7bf3d90
wip load new file
thorstink May 26, 2024
1665965
less colors
thorstink May 26, 2024
1bebf8d
remove some silly errors
thorstink May 27, 2024
aa33144
center at load
thorstink May 28, 2024
a986c21
save files
thorstink May 28, 2024
f97d5fa
bla
thorstink May 30, 2024
71b5039
optimization
thorstink May 30, 2024
3502d0a
add stuff
thorstink Jun 2, 2024
4b03817
add arcs
thorstink Jun 3, 2024
fa83fdf
file
thorstink Jun 4, 2024
73c3610
one pointer less
thorstink Jun 4, 2024
c565094
no more ptrs
thorstink Jun 5, 2024
d95eac0
remove arcs!
thorstink Jun 5, 2024
c35af24
little refactor
thorstink Jun 5, 2024
1a11ead
crash averted
thorstink Jun 5, 2024
84757ed
little refactor
thorstink Jun 5, 2024
762bd64
little refactor 5
thorstink Jun 5, 2024
21e57ec
more files
thorstink Jun 6, 2024
1c3c1e8
draw color menu
thorstink Jun 7, 2024
f89770c
make one view func
thorstink Jun 7, 2024
b243d1a
reorderd things
thorstink Jun 10, 2024
8f3c3af
update file
thorstink Jun 13, 2024
e7b7b77
update names
thorstink Jun 14, 2024
45e1d18
color
thorstink Jun 15, 2024
0149661
middle button
thorstink Jun 15, 2024
af13286
localz
thorstink Jun 15, 2024
c14e3b4
bla
thorstink Jun 15, 2024
9c5deb1
prettier add nodes
thorstink Jun 15, 2024
0dbee5d
heighlight target
thorstink Jun 15, 2024
57b3504
init view
thorstink Jun 15, 2024
448e078
color highlighting and tabs
thorstink Jun 16, 2024
5ccf6d5
add colors
thorstink Jun 16, 2024
29cff4c
marking!
thorstink Jun 16, 2024
4589f9b
up to 9
thorstink Jun 16, 2024
2a97488
up to colorz
thorstink Jun 16, 2024
9be1374
up to colorz
thorstink Jun 16, 2024
497ae87
undo
thorstink Jun 17, 2024
bfa86b1
undo 2
thorstink Jun 17, 2024
4c61e43
remove colors
thorstink Jun 17, 2024
febd492
bla bla
thorstink Jun 26, 2024
1bf6e7e
fire
thorstink Jun 28, 2024
06bdb35
fire
thorstink Jun 28, 2024
0c7bd28
fire
thorstink Jun 28, 2024
e9a35f0
fire
thorstink Jun 28, 2024
856078f
fire
thorstink Jun 28, 2024
3e1e4f8
dgkjfdklgj
thorstink Jul 1, 2024
0448d64
add and fire
thorstink Jul 4, 2024
6599eea
tmp
thorstink Sep 5, 2024
1e15fd2
Merge branch 'main' into feature/gui
thorstink Sep 5, 2024
3e97626
more c-str
thorstink Sep 5, 2024
4419937
fix remove arc bug
thorstink Sep 5, 2024
646f35e
fix fire bugz
thorstink Sep 7, 2024
db75fd6
more
thorstink Sep 9, 2024
1dad71a
clean kill
thorstink Sep 9, 2024
616e65d
hmmph
thorstink Sep 12, 2024
ced983f
opengl3 biuld
thorstink Sep 13, 2024
6be1888
drawables
thorstink Sep 14, 2024
66492a8
begin about
thorstink Sep 15, 2024
c9b7276
move some deps
thorstink Sep 15, 2024
12087ed
logo generator
thorstink Sep 16, 2024
ca6c511
updated small vector
thorstink Sep 16, 2024
3bad69c
better typename deduction
Sep 17, 2024
16f5b82
name test
thorstink Sep 17, 2024
58df279
imgui-less model
thorstink Sep 17, 2024
1349e83
imgui removed from model
thorstink Sep 17, 2024
ea0680c
remove file from cmakelists
thorstink Sep 17, 2024
be25f16
remove some headers
thorstink Sep 17, 2024
351b1f4
drag
thorstink Sep 17, 2024
4ea73dd
context manu drawable
thorstink Sep 17, 2024
36a08be
remove some iostreams
thorstink Sep 17, 2024
2175a57
fix bug
thorstink Sep 17, 2024
54cc69c
adding transition with uique names
thorstink Sep 18, 2024
f75ede0
naa
thorstink Sep 18, 2024
9ba1602
ref count is 1
thorstink Sep 19, 2024
a920aee
observe vs subscribe
thorstink Sep 19, 2024
767b6e3
nomore
thorstink Sep 19, 2024
7104e8a
fix tests and factor out rpp
thorstink Sep 23, 2024
146202f
artefact
thorstink Oct 1, 2024
fbf841a
artefact
thorstink Oct 1, 2024
af9dfdf
artefact
thorstink Oct 1, 2024
12f831d
macos pipe
thorstink Oct 1, 2024
b83209a
statics
thorstink Oct 4, 2024
3c969ff
app bundle
thorstink Oct 5, 2024
894c3d3
cmaked
thorstink Oct 6, 2024
5483c0d
colors slightly less weird
thorstink Oct 15, 2024
40bb71b
updated rpp
thorstink Oct 18, 2024
80b5866
version tag
thorstink Oct 18, 2024
49c2a1d
updated fixed small bug
thorstink Oct 31, 2024
97885b6
about copy to clipboard
thorstink Oct 31, 2024
1463927
little fancy ternary func call
thorstink Oct 31, 2024
5c48e3b
filesystem thingies
thorstink Nov 1, 2024
1ef7b50
rpp toying to create background threads for processing
thorstink Dec 29, 2024
2c3927a
tsan fix
thorstink Dec 29, 2024
c59d5d8
save on background thread
thorstink Dec 30, 2024
c6abf55
missing reference in viewmodel
thorstink Dec 30, 2024
cef1137
refactor toXml out of function
thorstink Dec 30, 2024
a324bd2
a somewhat blocking popup
thorstink Dec 31, 2024
7595907
less copies
thorstink Jan 4, 2025
8b4ea3a
construct in place
thorstink Jan 10, 2025
5bddcb3
construct in place
thorstink Jan 10, 2025
b48e9b6
attempt to make gcc happy
thorstink Jan 10, 2025
12b53eb
nicer default view
thorstink Jan 12, 2025
fbf3a68
simple fire logic
thorstink Feb 22, 2025
1a86e1c
update imfilebrowser
thorstink Feb 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 37 additions & 3 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,53 @@ name: Build project
on: [push]

jobs:
build-project:
build-mac:
runs-on: macos-14
steps:
- uses: actions/checkout@v1
- name: "build mac"
run: |
brew install glfw svg2png
git submodule update --init --recursive
mkdir build
cd build
bash -c 'cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON -DBUILD_GUI=ON ..'
make
- name: Upload macos
uses: actions/upload-artifact@v4
with:
name: Farbart macos
path: build/Farbart.tar.gz

build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "build project"
- name: "build linux"
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev libvulkan-dev
git submodule update --init --recursive
mkdir build
cd build
bash -c 'cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON ..'
bash -c 'cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON -DBUILD_GUI=ON ..'
make
- name: Upload linux
uses: actions/upload-artifact@v4
with:
name: Farbart linux x64-86
path: build/symmetri/gui/Farbart

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "tests with ASAN"
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev libvulkan-dev
git submodule update --init --recursive
mkdir build
cd build
bash -c 'cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DASAN_BUILD=ON -DTSAN_BUILD=OFF ..'
make
Expand All @@ -25,6 +58,7 @@ jobs:
- name: "tests with TSAN"
run: |
cd build
make clean
bash -c 'cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DASAN_BUILD=OFF -DTSAN_BUILD=ON ..'
make
ctest -VV
26 changes: 26 additions & 0 deletions .github/workflows/macos/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>Farbart</string>
<key>CFBundleExecutable</key>
<string>Farbart</string>
<key>CFBundleIdentifier</key>
<string>www.symmetri.net</string>
<key>CFBundleName</key>
<string>Farbart</string>
<key>CFBundleIconFile</key>
<string>farbart.icns</string>
<key>CFBundleShortVersionString</key>
<string>0.01</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>IFMajorVersion</key>
<integer>0</integer>
<key>IFMinorVersion</key>
<integer>1</integer>
</dict>
</plist>
11 changes: 11 additions & 0 deletions .github/workflows/macos/create_app_bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#/bin/bash

./symmetri/gui/generate_icon $(echo $((1 + $RANDOM % 9))) icon.svg
source ../.github/workflows/macos/create_icons.sh
svg_to_icns icon.svg
rm -r Farbart.app
mkdir -p Farbart.app/Contents Farbart.app/Contents/MacOS Farbart.app/Contents/Resources
cp icons/icon.icns Farbart.app/Contents/Resources/farbart.icns
cp ../.github/workflows/macos/Info.plist Farbart.app/Contents/Info.plist
cp symmetri/gui/Farbart Farbart.app/Contents/MacOS/Farbart
tar -czf Farbart.tar.gz Farbart.app
31 changes: 31 additions & 0 deletions .github/workflows/macos/create_icons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# taken from
# https://gist.github.com/adriansr/1da9b18a8076b0f8a977a5eea0ae41ef

function svg_to_icns(){
local RESOLUTIONS=(
16,16x16
32,16x16@2x
32,32x32
64,32x32@2x
128,128x128
256,128x128@2x
256,256x256
512,256x256@2x
512,512x512
1024,512x512@2x
)

for SVG in $@; do
BASE=$(basename "$SVG" | sed 's/\.[^\.]*$//')
ICONSET="$BASE.iconset"
ICONSET_DIR="./icons/$ICONSET"
mkdir -p "$ICONSET_DIR"
for RES in ${RESOLUTIONS[@]}; do
SIZE=$(echo $RES | cut -d, -f1)
LABEL=$(echo $RES | cut -d, -f2)
svg2png -w $SIZE -h $SIZE "$SVG" "$ICONSET_DIR"/icon_$LABEL.png
done

iconutil -c icns "$ICONSET_DIR"
done
}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "submodules/tinyxml2"]
path = symmetri/submodules/tinyxml2
url = https://github.com/leethomason/tinyxml2.git
[submodule "symmetri/gui/imgui"]
path = symmetri/gui/imgui
url = https://github.com/ocornut/imgui.git
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ if(BUILD_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address,undefined -fno-omit-frame-pointer -O0")
elseif(TSAN_BUILD AND NOT ASAN_BUILD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=thread -fno-omit-frame-pointer -O0")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tsan")
endif()

else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=auto -O3")
endif()
Expand Down
58 changes: 31 additions & 27 deletions examples/combinations/DualProcessWorker.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@
<place id="TaskBucket">
<name>
<graphics>
<offset x="0" y="15"/>
<offset x="0" y="15" />
</graphics>
<text>TaskBucket</text>
</name>
<graphics>
<position x="80" y="120"/>
<position x="80" y="120" />
</graphics>
</place>
<place id="TaskResult">
<name>
<graphics>
<offset x="0" y="15"/>
<offset x="0" y="15" />
</graphics>
<text>TaskResult</text>
</name>
<graphics>
<position x="290" y="120"/>
<position x="290" y="120" />
</graphics>
</place>
<place id="IntermediateState">
<name>
<graphics>
<offset x="0" y="15"/>
<offset x="0" y="15" />
</graphics>
<text>IntermediateState</text>
</name>
<graphics>
<position x="190" y="120"/>
<position x="190" y="120" />
</graphics>
</place>
<place id="ResourceDualProcessor">
<name>
<graphics>
<offset x="0" y="15"/>
<offset x="0" y="15" />
</graphics>
<text>ResourceDualProcessor</text>
</name>
<graphics>
<position x="130" y="60"/>
<position x="130" y="60" />
</graphics>
<initialMarking>
<text>1</text>
Expand All @@ -60,90 +60,94 @@
<place id="P0">
<name>
<graphics>
<offset x="0" y="15"/>
<offset x="0" y="15" />
</graphics>
<text>P0</text>
</name>
<graphics>
<position x="130" y="190"/>
<position x="130" y="190" />
</graphics>
<initialMarking>
<text>6</text>
</initialMarking>

</place>
<place id="SuccessfulTasks">
<name>
<graphics>
<offset x="0" y="15"/>
<offset x="0" y="15" />
</graphics>
<text>SuccessfulTasks</text>
</name>
<graphics>
<position x="190" y="10"/>
<position x="190" y="10" />
</graphics>
</place>
<!-- List of transitions -->
<transition id="StepOne">
<name>
<graphics>
<offset x="0" y="-15"/>
<offset x="0" y="-15" />
</graphics>
<text>StepOne</text>
</name>
<graphics>
<position x="135" y="120"/>
<position x="135" y="120" />
</graphics>
</transition>
<transition id="returnFailedTasksTwo">
<name>
<graphics>
<offset x="0" y="-15"/>
<offset x="0" y="-15" />
</graphics>
<text>returnFailedTasksTwo</text>
</name>
<graphics>
<position x="195" y="210"/>
<position x="195" y="210" />
</graphics>
</transition>
<transition id="StepTwo">
<name>
<graphics>
<offset x="0" y="-15"/>
<offset x="0" y="-15" />
</graphics>
<text>StepTwo</text>
</name>
<graphics>
<position x="245" y="120"/>
<position x="245" y="120" />
</graphics>
</transition>
<transition id="returnFailedTasksOne">
<name>
<graphics>
<offset x="0" y="-15"/>
<offset x="0" y="-15" />
</graphics>
<text>returnFailedTasksOne</text>
</name>
<graphics>
<position x="195" y="170"/>
<position x="195" y="170" />
</graphics>
</transition>
<transition id="releaseResourceAfterFail">
<name>
<graphics>
<offset x="0" y="-15"/>
<offset x="0" y="-15" />
</graphics>
<text>releaseResourceAfterFail</text>
</name>
<graphics>
<position x="55" y="190"/>
<position x="55" y="190" />
</graphics>
</transition>
<transition id="releaseResourceAfterSuccess">
<name>
<graphics>
<offset x="0" y="-15"/>
<offset x="0" y="-15" />
</graphics>
<text>releaseResourceAfterSuccess</text>
</name>
<graphics>
<position x="195" y="60"/>
<position x="195" y="60" />
</graphics>
</transition>
<!-- List of arcs -->
Expand All @@ -165,19 +169,19 @@
</arc>
<arc id="id9" source="releaseResourceAfterFail" target="ResourceDualProcessor">
<graphics>
<position x="60" y="70"/>
<position x="60" y="70" />
</graphics>
</arc>
<arc id="id10" source="releaseResourceAfterSuccess" target="ResourceDualProcessor">
</arc>
<arc id="id11" source="TaskResult" target="releaseResourceAfterSuccess">
<graphics>
<position x="300" y="70"/>
<position x="300" y="70" />
</graphics>
</arc>
<arc id="id12" source="TaskResult" target="returnFailedTasksTwo" color="Red">
<graphics>
<position x="300" y="220"/>
<position x="300" y="220" />
</graphics>
</arc>
<arc id="id13" source="ResourceDualProcessor" target="StepOne">
Expand Down
8 changes: 4 additions & 4 deletions examples/flight/flight.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ int main(int, char *argv[]) {
Marking sub_goal_marking = {{"P2", Success}};
std::set<std::string> pnmls = {pnml1, pnml2};
PetriNet subnet(pnmls, "SubNet", pool, sub_goal_marking);
subnet.registerCallback("T0", Foo("SubFoo"));
subnet.registerCallback("T1", Foo("SubBar"));
subnet.registerCallbackInPlace<Foo>("T0", "SubFoo");
subnet.registerCallbackInPlace<Foo>("T1", "SubBar");

// We create another PetriNet by flatly composing all three petri nets.
// Again we have 2 Foo-transitions, and the first transition (T0) is the
Expand All @@ -72,8 +72,8 @@ int main(int, char *argv[]) {
{"P3", Success}};
PetriNet bignet({pnml1, pnml2, pnml3}, "RootNet", pool, big_goal_marking);
bignet.registerCallback("T0", subnet);
bignet.registerCallback("T1", Foo("Bar"));
bignet.registerCallback("T2", Foo("Foo"));
bignet.registerCallbackInPlace<Foo>("T1", "Bar");
bignet.registerCallbackInPlace<Foo>("T2", "Foo");
// a flag to check if we are running
std::atomic<bool> running(true);

Expand Down
14 changes: 7 additions & 7 deletions examples/flight/transition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class Foo {

public:
Foo(std::string m, unsigned count = 5, int s = 1)
: name(m), count(count), interval(s), cancel_(false), is_paused_(false) {}
Foo(const Foo &o)
: name(o.name),
count(o.count),
interval(o.interval),
cancel_(false),
is_paused_(false) {}
: name(m), count(count), interval(s), cancel_(false), is_paused_(false) {
printf("ctor %s\n", m.c_str());
}
Foo(Foo&& f) = delete;
Foo(const Foo& o) = delete;
Foo& operator=(Foo&& other) = delete;
Foo& operator=(const Foo& other) = delete;

bool fire() const {
cancel_.store(false);
Expand Down
2 changes: 1 addition & 1 deletion examples/performance/performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) {
{"Pb", Success}, {"Pb", Success}, {"Pc", Success}, {"Pc", Success}};

PetriNet petri(net, "benchmark", pool, initial_marking, goal_marking);
petri.registerCallback("t0", Simple{});
petri.registerCallbackInPlace<Simple>("t0");
petri.registerCallback("t1", Simple{});
return petri;
}
Expand Down
Loading