Skip to content

Commit 0a8068b

Browse files
committed
BInd last answer action to F7
1 parent 1a7b772 commit 0a8068b

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

src/shell/MainWindow.vala

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,12 @@ namespace Pebbles {
592592
if (keyval == Gdk.Key.F8) {
593593
on_change_mode ();
594594
return;
595+
} else if (keyval == Gdk.Key.F7) {
596+
on_last_ans ();
597+
return;
595598
}
596599

600+
597601
on_key_up (view_stack.visible_child_name, keyval);
598602

599603
if (view_stack.visible_child_name == Context.STATISTICS && keyval == Gdk.Key.Tab) {
@@ -840,6 +844,23 @@ namespace Pebbles {
840844
programmer_view.send_shift_modifier (on);
841845
}
842846

847+
protected void on_last_ans () {
848+
switch (view_stack.visible_child_name) {
849+
case Context.SCIENTIFIC:
850+
scientific_view.on_click_last_ans ();
851+
break;
852+
case Context.CALCULUS:
853+
calculus_view.on_click_last_ans ();
854+
break;
855+
case Context.PROGRAMMER:
856+
programmer_view.on_click_last_ans ();
857+
break;
858+
case Context.GRAPHING:
859+
graphing_view.on_click_last_ans ();
860+
break;
861+
}
862+
}
863+
843864
[GtkCallback]
844865
protected void set_theme (Gtk.CheckButton button) {
845866
if (button.active) {

src/shell/views/GraphingView.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ namespace Pebbles {
315315
}
316316

317317
[GtkCallback]
318-
protected void on_click_last_ans () {
318+
public void on_click_last_ans () {
319319
display.write ("Sans");
320320
}
321321

src/shell/views/converters/ConverterView.vala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ namespace Pebbles {
5050
from_entry_focus_controller.leave.connect (() => {
5151
from_entry.add_css_class ("conversion-text-box-focused");
5252
});
53+
focused_entry = from_entry;
5354

5455
to_entry_focus_controller = new Gtk.EventControllerFocus ();
5556
to_entry.add_controller (to_entry_focus_controller);
@@ -245,7 +246,10 @@ namespace Pebbles {
245246
}
246247

247248
public override void focus_main () {
248-
249+
Idle.add_once (() => {
250+
focused_entry.grab_focus_without_selecting ();
251+
focused_entry.set_position ((int) focused_entry.text_length);
252+
});
249253
}
250254
}
251255
}

src/shell/widgets/displays/HistoryDisplay.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Pebbles {
1414
realize.connect (() => {
1515
Timeout.add_once (100, () => {
1616
var win = (MainWindow) get_ancestor (typeof (MainWindow));
17-
print ("Refreshing history of %s\n", context);
17+
print ("DEBUG: Refreshing history of %s\n", context);
1818
win.on_history_view (context);
1919
});
2020
});

src/shell/widgets/displays/ProgrammerDisplay.vala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ namespace Pebbles {
255255
}
256256

257257
public void focus_entry () {
258-
main_entry.grab_focus_without_selecting ();
259-
main_entry.set_position (-1);
258+
Idle.add_once (() => {
259+
main_entry.grab_focus_without_selecting ();
260+
main_entry.set_position (-1);
261+
});
260262
}
261263

262264
public void write (string str) {
@@ -307,7 +309,6 @@ namespace Pebbles {
307309
}
308310

309311
protected bool input_handler (string full_expression, int input_length, string input_char) {
310-
print ("Hi>>> %s %d %s\n", full_expression, input_length, input_char);
311312
display_all_number_systems ();
312313

313314
if (input_char != "" && !entry_formatter.is_rule_present (input_char)) {

0 commit comments

Comments
 (0)