Save shortcut & notification animation
This commit is contained in:
parent
24a4fc9500
commit
53fe5511e0
32
source/app.d
32
source/app.d
@ -18,6 +18,7 @@ import gtk.VBox;
|
||||
import gtk.Statusbar;
|
||||
import gtk.Button;
|
||||
import gtk.ScrolledWindow;
|
||||
import gtk.AccelGroup;
|
||||
|
||||
import gtk.HBox;
|
||||
|
||||
@ -30,6 +31,9 @@ void main(string[] args)
|
||||
//Window
|
||||
window = new MainWindow("2DA-Edit");
|
||||
|
||||
auto accel = new AccelGroup();
|
||||
window.addAccelGroup(accel);
|
||||
|
||||
auto cont = new VBox(false, 0);
|
||||
window.add(cont);
|
||||
cont.setSizeRequest(300, 200);
|
||||
@ -51,6 +55,8 @@ void main(string[] args)
|
||||
auto buttonNewCol = new Button("tab-new-symbolic", GtkIconSize.SMALL_TOOLBAR);
|
||||
}
|
||||
buttonSave.setTooltipText("Save");
|
||||
enum GDK_KEY_S = 0x053;
|
||||
buttonSave.addAccelerator("clicked", accel, GDK_KEY_S, GdkModifierType.CONTROL_MASK, GtkAccelFlags.VISIBLE);
|
||||
buttonOpen.setTooltipText("Open 2DA");
|
||||
buttonInsert.setTooltipText("Insert row after");
|
||||
buttonDelete.setTooltipText("Delete row");
|
||||
@ -120,6 +126,31 @@ void main(string[] args)
|
||||
//Configure button callbacks
|
||||
buttonSave.addOnClicked((Button){
|
||||
Save(tree);
|
||||
|
||||
import core.thread;
|
||||
new Thread({
|
||||
Thread.getThis.sleep(dur!"msecs"(100));
|
||||
|
||||
auto lbl = new Label("");
|
||||
lbl.setMarkup("<i>File saved</i>");
|
||||
statusbar.packEnd(lbl, false, false, 5);
|
||||
|
||||
//Wow, much animation, very badass
|
||||
lbl.setOpacity(0.0);
|
||||
lbl.show();
|
||||
foreach(i ; 0..20){
|
||||
lbl.setOpacity(i/20.0);
|
||||
Thread.getThis.sleep(dur!"msecs"(10));
|
||||
}
|
||||
Thread.getThis.sleep(dur!"msecs"(1500));
|
||||
foreach(i ; 1..20){
|
||||
lbl.setOpacity(1.0-i/20.0);
|
||||
Thread.getThis.sleep(dur!"msecs"(10));
|
||||
}
|
||||
//Destroy
|
||||
lbl.destroy();
|
||||
}).start();
|
||||
|
||||
});
|
||||
|
||||
buttonOpen.addOnClicked((Button){
|
||||
@ -269,7 +300,6 @@ void Save(ref TreeView tree){
|
||||
}
|
||||
else
|
||||
writeln("Nothing to save !");
|
||||
|
||||
}
|
||||
|
||||
string openedFile;
|
||||
|
Loading…
Reference in New Issue
Block a user