Column renaming
This commit is contained in:
parent
1fa225471e
commit
8c3bbad2c2
32
source/app.d
32
source/app.d
@ -101,8 +101,8 @@ void main(string[] args)
|
|||||||
auto res = fc.run();
|
auto res = fc.run();
|
||||||
if(res==GtkResponseType.OK){
|
if(res==GtkResponseType.OK){
|
||||||
string filename = fc.getFilename();
|
string filename = fc.getFilename();
|
||||||
version(Windows) Open(filename, tree, cast(Object)window);
|
version(Windows) Open(filename, window, tree, cast(Object)window);
|
||||||
else Open(filename, tree, cast(Object)header);
|
else Open(filename, window, tree, cast(Object)header);
|
||||||
}
|
}
|
||||||
fc.destroy();
|
fc.destroy();
|
||||||
});
|
});
|
||||||
@ -147,8 +147,8 @@ void main(string[] args)
|
|||||||
|
|
||||||
//Open if exists
|
//Open if exists
|
||||||
if(args.length>=2 && exists(args[1])){
|
if(args.length>=2 && exists(args[1])){
|
||||||
version(Windows) Open(args[1], tree, cast(Object)window);
|
version(Windows) Open(args[1], window, tree, cast(Object)window);
|
||||||
else Open(args[1], tree, cast(Object)header);
|
else Open(args[1], window, tree, cast(Object)header);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.showAll();
|
window.showAll();
|
||||||
@ -188,13 +188,13 @@ void Save(ref TreeView tree){
|
|||||||
}
|
}
|
||||||
|
|
||||||
string openedFile;
|
string openedFile;
|
||||||
void Open(string file, ref TreeView tree, Object header){
|
void Open(string file, ref MainWindow win, ref TreeView tree, Object header){
|
||||||
|
|
||||||
auto twoda = new TwoDA(file);
|
auto twoda = new TwoDA(file);
|
||||||
|
|
||||||
openedFile = file;
|
openedFile = file;
|
||||||
|
|
||||||
version(Windows) (cast(Window)header).setTitle(file);
|
version(Windows) (cast(MainWindow)header).setTitle(file);
|
||||||
else{
|
else{
|
||||||
import gtk.HeaderBar;
|
import gtk.HeaderBar;
|
||||||
(cast(HeaderBar)header).setSubtitle(file);
|
(cast(HeaderBar)header).setSubtitle(file);
|
||||||
@ -252,7 +252,25 @@ void Open(string file, ref TreeView tree, Object header){
|
|||||||
|
|
||||||
auto col = new TreeViewColumn(s, cr, "text", cast(int)index);
|
auto col = new TreeViewColumn(s, cr, "text", cast(int)index);
|
||||||
col.setResizable(true);
|
col.setResizable(true);
|
||||||
//col.setReorderable(true);
|
col.setClickable(true);
|
||||||
|
col.addOnClicked((TreeViewColumn col){
|
||||||
|
import gtk.Dialog;
|
||||||
|
auto dlg = new Dialog("Rename column", win, GtkDialogFlags.MODAL, ["Cancel","Rename"], [ResponseType.CANCEL, ResponseType.OK]);
|
||||||
|
auto entry = new Entry(col.getTitle);
|
||||||
|
dlg.getContentArea.packStart(entry, false, false, 5);
|
||||||
|
entry.show();
|
||||||
|
|
||||||
|
if(dlg.run()==ResponseType.OK){
|
||||||
|
auto newname = entry.getText.strip;
|
||||||
|
if(newname.countchars(" \t\n\r")==0)
|
||||||
|
col.setTitle(newname);
|
||||||
|
else
|
||||||
|
writeln("Unauthorized caracters in column name");
|
||||||
|
}
|
||||||
|
|
||||||
|
dlg.destroy();
|
||||||
|
|
||||||
|
});
|
||||||
tree.appendColumn(col);
|
tree.appendColumn(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user