commit 99291fe235dbab92a87150221c9d7c78910cfcac Author: Crom (Thibaut CHARLES) Date: Sun Nov 16 23:48:56 2014 +0100 First commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46d9b74 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.dub/ +dub.selections.json +2daedit* diff --git a/dub.json b/dub.json new file mode 100644 index 0000000..b14f1a4 --- /dev/null +++ b/dub.json @@ -0,0 +1,9 @@ +{ + "name": "2daedit", + "description": "A minimal D application.", + "copyright": "Copyright © 2014, Administrateur", + "authors": ["Administrateur"], + "dependencies": { + "gtk-d": ">=2.4.1" + } +} diff --git a/libatk-1.0-0.dll b/libatk-1.0-0.dll new file mode 100644 index 0000000..2855aee Binary files /dev/null and b/libatk-1.0-0.dll differ diff --git a/libcairo-2.dll b/libcairo-2.dll new file mode 100644 index 0000000..482140e Binary files /dev/null and b/libcairo-2.dll differ diff --git a/libcairo-gobject-2.dll b/libcairo-gobject-2.dll new file mode 100644 index 0000000..2fe4f45 Binary files /dev/null and b/libcairo-gobject-2.dll differ diff --git a/libcairo-script-interpreter-2.dll b/libcairo-script-interpreter-2.dll new file mode 100644 index 0000000..ccfe668 Binary files /dev/null and b/libcairo-script-interpreter-2.dll differ diff --git a/libcroco-0.6-3.dll b/libcroco-0.6-3.dll new file mode 100644 index 0000000..15b60d8 Binary files /dev/null and b/libcroco-0.6-3.dll differ diff --git a/libffi-6.dll b/libffi-6.dll new file mode 100644 index 0000000..ebe9c0d Binary files /dev/null and b/libffi-6.dll differ diff --git a/libfontconfig-1.dll b/libfontconfig-1.dll new file mode 100644 index 0000000..29e6fc5 Binary files /dev/null and b/libfontconfig-1.dll differ diff --git a/libfreetype-6.dll b/libfreetype-6.dll new file mode 100644 index 0000000..339afdf Binary files /dev/null and b/libfreetype-6.dll differ diff --git a/libgailutil-3-0.dll b/libgailutil-3-0.dll new file mode 100644 index 0000000..e320c63 Binary files /dev/null and b/libgailutil-3-0.dll differ diff --git a/libgdk-3-0.dll b/libgdk-3-0.dll new file mode 100644 index 0000000..9e6af0a Binary files /dev/null and b/libgdk-3-0.dll differ diff --git a/libgdk_pixbuf-2.0-0.dll b/libgdk_pixbuf-2.0-0.dll new file mode 100644 index 0000000..ef964ac Binary files /dev/null and b/libgdk_pixbuf-2.0-0.dll differ diff --git a/libgio-2.0-0.dll b/libgio-2.0-0.dll new file mode 100644 index 0000000..015d7fb Binary files /dev/null and b/libgio-2.0-0.dll differ diff --git a/libglib-2.0-0.dll b/libglib-2.0-0.dll new file mode 100644 index 0000000..f8a1a1d Binary files /dev/null and b/libglib-2.0-0.dll differ diff --git a/libgmodule-2.0-0.dll b/libgmodule-2.0-0.dll new file mode 100644 index 0000000..3118756 Binary files /dev/null and b/libgmodule-2.0-0.dll differ diff --git a/libgobject-2.0-0.dll b/libgobject-2.0-0.dll new file mode 100644 index 0000000..d95f7a3 Binary files /dev/null and b/libgobject-2.0-0.dll differ diff --git a/libgthread-2.0-0.dll b/libgthread-2.0-0.dll new file mode 100644 index 0000000..114c0f4 Binary files /dev/null and b/libgthread-2.0-0.dll differ diff --git a/libgtk-3-0.dll b/libgtk-3-0.dll new file mode 100644 index 0000000..89a54e6 Binary files /dev/null and b/libgtk-3-0.dll differ diff --git a/libiconv-2.dll b/libiconv-2.dll new file mode 100644 index 0000000..e7a0887 Binary files /dev/null and b/libiconv-2.dll differ diff --git a/libintl-8.dll b/libintl-8.dll new file mode 100644 index 0000000..3d53213 Binary files /dev/null and b/libintl-8.dll differ diff --git a/libjasper-1.dll b/libjasper-1.dll new file mode 100644 index 0000000..80a7906 Binary files /dev/null and b/libjasper-1.dll differ diff --git a/libjpeg-9.dll b/libjpeg-9.dll new file mode 100644 index 0000000..3517cc4 Binary files /dev/null and b/libjpeg-9.dll differ diff --git a/liblzma-5.dll b/liblzma-5.dll new file mode 100644 index 0000000..baa9383 Binary files /dev/null and b/liblzma-5.dll differ diff --git a/libpango-1.0-0.dll b/libpango-1.0-0.dll new file mode 100644 index 0000000..2e1d5c4 Binary files /dev/null and b/libpango-1.0-0.dll differ diff --git a/libpangocairo-1.0-0.dll b/libpangocairo-1.0-0.dll new file mode 100644 index 0000000..69aefd5 Binary files /dev/null and b/libpangocairo-1.0-0.dll differ diff --git a/libpangoft2-1.0-0.dll b/libpangoft2-1.0-0.dll new file mode 100644 index 0000000..a1629f2 Binary files /dev/null and b/libpangoft2-1.0-0.dll differ diff --git a/libpangowin32-1.0-0.dll b/libpangowin32-1.0-0.dll new file mode 100644 index 0000000..2ac3967 Binary files /dev/null and b/libpangowin32-1.0-0.dll differ diff --git a/libpixman-1-0.dll b/libpixman-1-0.dll new file mode 100644 index 0000000..b1bd7ba Binary files /dev/null and b/libpixman-1-0.dll differ diff --git a/libpng15-15.dll b/libpng15-15.dll new file mode 100644 index 0000000..ba04508 Binary files /dev/null and b/libpng15-15.dll differ diff --git a/librsvg-2-2.dll b/librsvg-2-2.dll new file mode 100644 index 0000000..a82147e Binary files /dev/null and b/librsvg-2-2.dll differ diff --git a/libtiff-5.dll b/libtiff-5.dll new file mode 100644 index 0000000..32d1179 Binary files /dev/null and b/libtiff-5.dll differ diff --git a/libxml2-2.dll b/libxml2-2.dll new file mode 100644 index 0000000..3c371de Binary files /dev/null and b/libxml2-2.dll differ diff --git a/pthreadGC2.dll b/pthreadGC2.dll new file mode 100644 index 0000000..b1786fb Binary files /dev/null and b/pthreadGC2.dll differ diff --git a/source/app.d b/source/app.d new file mode 100644 index 0000000..3f357ec --- /dev/null +++ b/source/app.d @@ -0,0 +1,135 @@ +import std.stdio; +import std.string; +import std.conv : to; + + +import gtk.Main; +import gtk.MainWindow; +import gtk.TreeView; +import gtk.ListStore; +import gtk.TreeViewColumn; +import gtk.TreeIter; +import gtk.Label; +import gtk.Entry; +import gtk.CellRenderer; +import gtk.CellRendererText; +import gtk.CellRendererSpin; + +void[] Serialize(VT...)(VT data){ + void[] ret; + foreach(d ; data){ + ret~=cast(void[])([d]); + } + return ret; +} + +void main(string[] args) +{ + auto twoda = new TwoDA("test.2da"); + + + Main.init(args); + + auto window = new MainWindow("Test"); + + + auto store = new ListStore([GType.STRING,GType.STRING,GType.STRING]); + + auto tree = new TreeView(store); + window.add(tree); + tree.setHeadersVisible(true); + tree.setEnableSearch(true); + tree.setModel(store); + + foreach(index, s ; twoda.header){ + + CellRenderer cr; + writeln(index); + if(index==0){ + cr = new CellRendererSpinner(); + cr.setProperty("pulse", 1); + cr.setProperty("active", true); + } + else{ + cr = new CellRendererText(); + cr.setProperty("editable", true); + } + + //cr.setSensitive(true); + + auto col = new TreeViewColumn(s, cr, "text", index); + col.setResizable(true); + //if(index!=0) col.setReorderable(true); + tree.appendColumn(col); + } + + TreeIter iter = store.createIter(); + + + for(int i=0 ; i<=twoda.lastLine ; i++){ + store.setValue(iter, 0, i); + + if(i in twoda.values){ + foreach(index, v ; twoda.values[i]){ + store.setValue(iter, index+1, v); + } + } + else{ + foreach(index ; 1..twoda.header.length){ + store.setValue(iter, index+1, "_"); + } + } + store.append(iter); + + } + + tree.columnsAutosize(); + + + window.showAll(); + Main.run(); +} + + + +class TwoDA{ + import std.regex; + import std.file; + + this(string filepath){ + lastLine = 0; + foreach(index, line ; readText(filepath).splitLines()){ + + string data[]; + + auto results = matchAll(line, rgxField); + foreach(res ; results){ + string s; + if(res[0][0]=='"') data~= res[2]; + else data~= res[1]; + } + + if(index==0){ + header = data; + //writeln(header); + } + else{ + int nLine = data[0].to!int; + values[nLine] = data[1..$]; + //writeln(values[nLine]); + + if(nLine > lastLine) + lastLine = nLine; + } + + } + + } + + + string[] header; + string[][uint] values; + uint lastLine; + enum rgxField = ctRegex!"(?:\\b([^\\s]+?)\\b|\"([^\"]+?)\")"; +} + diff --git a/test.2da b/test.2da new file mode 100644 index 0000000..d331a76 --- /dev/null +++ b/test.2da @@ -0,0 +1,4 @@ +id name value +0 test testvalue0 +1 test1 testvalue1 +2 "Test Multiword" "Ddeedz fdes s fesq qs g sfddtrs" \ No newline at end of file diff --git a/zlib1.dll b/zlib1.dll new file mode 100644 index 0000000..d948931 Binary files /dev/null and b/zlib1.dll differ