Browse Source

First commit

master
Crom (Thibaut CHARLES) 8 years ago
commit
99291fe235
  1. 3
      .gitignore
  2. 9
      dub.json
  3. BIN
      libatk-1.0-0.dll
  4. BIN
      libcairo-2.dll
  5. BIN
      libcairo-gobject-2.dll
  6. BIN
      libcairo-script-interpreter-2.dll
  7. BIN
      libcroco-0.6-3.dll
  8. BIN
      libffi-6.dll
  9. BIN
      libfontconfig-1.dll
  10. BIN
      libfreetype-6.dll
  11. BIN
      libgailutil-3-0.dll
  12. BIN
      libgdk-3-0.dll
  13. BIN
      libgdk_pixbuf-2.0-0.dll
  14. BIN
      libgio-2.0-0.dll
  15. BIN
      libglib-2.0-0.dll
  16. BIN
      libgmodule-2.0-0.dll
  17. BIN
      libgobject-2.0-0.dll
  18. BIN
      libgthread-2.0-0.dll
  19. BIN
      libgtk-3-0.dll
  20. BIN
      libiconv-2.dll
  21. BIN
      libintl-8.dll
  22. BIN
      libjasper-1.dll
  23. BIN
      libjpeg-9.dll
  24. BIN
      liblzma-5.dll
  25. BIN
      libpango-1.0-0.dll
  26. BIN
      libpangocairo-1.0-0.dll
  27. BIN
      libpangoft2-1.0-0.dll
  28. BIN
      libpangowin32-1.0-0.dll
  29. BIN
      libpixman-1-0.dll
  30. BIN
      libpng15-15.dll
  31. BIN
      librsvg-2-2.dll
  32. BIN
      libtiff-5.dll
  33. BIN
      libxml2-2.dll
  34. BIN
      pthreadGC2.dll
  35. 135
      source/app.d
  36. 4
      test.2da
  37. BIN
      zlib1.dll

3
.gitignore vendored

@ -0,0 +1,3 @@
.dub/
dub.selections.json
2daedit*

9
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"
}
}

BIN
libatk-1.0-0.dll

Binary file not shown.

BIN
libcairo-2.dll

Binary file not shown.

BIN
libcairo-gobject-2.dll

Binary file not shown.

BIN
libcairo-script-interpreter-2.dll

Binary file not shown.

BIN
libcroco-0.6-3.dll

Binary file not shown.

BIN
libffi-6.dll

Binary file not shown.

BIN
libfontconfig-1.dll

Binary file not shown.

BIN
libfreetype-6.dll

Binary file not shown.

BIN
libgailutil-3-0.dll

Binary file not shown.

BIN
libgdk-3-0.dll

Binary file not shown.

BIN
libgdk_pixbuf-2.0-0.dll

Binary file not shown.

BIN
libgio-2.0-0.dll

Binary file not shown.

BIN
libglib-2.0-0.dll

Binary file not shown.

BIN
libgmodule-2.0-0.dll

Binary file not shown.

BIN
libgobject-2.0-0.dll

Binary file not shown.

BIN
libgthread-2.0-0.dll

Binary file not shown.

BIN
libgtk-3-0.dll

Binary file not shown.

BIN
libiconv-2.dll

Binary file not shown.

BIN
libintl-8.dll

Binary file not shown.

BIN
libjasper-1.dll

Binary file not shown.

BIN
libjpeg-9.dll

Binary file not shown.

BIN
liblzma-5.dll

Binary file not shown.

BIN
libpango-1.0-0.dll

Binary file not shown.

BIN
libpangocairo-1.0-0.dll

Binary file not shown.

BIN
libpangoft2-1.0-0.dll

Binary file not shown.

BIN
libpangowin32-1.0-0.dll

Binary file not shown.

BIN
libpixman-1-0.dll

Binary file not shown.

BIN
libpng15-15.dll

Binary file not shown.

BIN
librsvg-2-2.dll

Binary file not shown.

BIN
libtiff-5.dll

Binary file not shown.

BIN
libxml2-2.dll

Binary file not shown.

BIN
pthreadGC2.dll

Binary file not shown.

135
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|\"([^\"]+?)\")";
}

4
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"

BIN
zlib1.dll

Binary file not shown.
Loading…
Cancel
Save