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.Statusbar;
|
||||||
import gtk.Button;
|
import gtk.Button;
|
||||||
import gtk.ScrolledWindow;
|
import gtk.ScrolledWindow;
|
||||||
|
import gtk.AccelGroup;
|
||||||
|
|
||||||
import gtk.HBox;
|
import gtk.HBox;
|
||||||
|
|
||||||
@ -30,6 +31,9 @@ void main(string[] args)
|
|||||||
//Window
|
//Window
|
||||||
window = new MainWindow("2DA-Edit");
|
window = new MainWindow("2DA-Edit");
|
||||||
|
|
||||||
|
auto accel = new AccelGroup();
|
||||||
|
window.addAccelGroup(accel);
|
||||||
|
|
||||||
auto cont = new VBox(false, 0);
|
auto cont = new VBox(false, 0);
|
||||||
window.add(cont);
|
window.add(cont);
|
||||||
cont.setSizeRequest(300, 200);
|
cont.setSizeRequest(300, 200);
|
||||||
@ -51,6 +55,8 @@ void main(string[] args)
|
|||||||
auto buttonNewCol = new Button("tab-new-symbolic", GtkIconSize.SMALL_TOOLBAR);
|
auto buttonNewCol = new Button("tab-new-symbolic", GtkIconSize.SMALL_TOOLBAR);
|
||||||
}
|
}
|
||||||
buttonSave.setTooltipText("Save");
|
buttonSave.setTooltipText("Save");
|
||||||
|
enum GDK_KEY_S = 0x053;
|
||||||
|
buttonSave.addAccelerator("clicked", accel, GDK_KEY_S, GdkModifierType.CONTROL_MASK, GtkAccelFlags.VISIBLE);
|
||||||
buttonOpen.setTooltipText("Open 2DA");
|
buttonOpen.setTooltipText("Open 2DA");
|
||||||
buttonInsert.setTooltipText("Insert row after");
|
buttonInsert.setTooltipText("Insert row after");
|
||||||
buttonDelete.setTooltipText("Delete row");
|
buttonDelete.setTooltipText("Delete row");
|
||||||
@ -120,6 +126,31 @@ void main(string[] args)
|
|||||||
//Configure button callbacks
|
//Configure button callbacks
|
||||||
buttonSave.addOnClicked((Button){
|
buttonSave.addOnClicked((Button){
|
||||||
Save(tree);
|
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){
|
buttonOpen.addOnClicked((Button){
|
||||||
@ -269,7 +300,6 @@ void Save(ref TreeView tree){
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
writeln("Nothing to save !");
|
writeln("Nothing to save !");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string openedFile;
|
string openedFile;
|
||||||
|
Loading…
Reference in New Issue
Block a user