~ubuntu-branches/ubuntu/precise/shotwell/precise-proposed

« back to all changes in this revision

Viewing changes to src/editing_tools/StraightenTool.vala

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2012-03-07 10:27:48 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20120307102748-poymprhn45k75l09
Tags: 0.11.93-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
            description_label.set_padding(0,0);
44
44
            angle_label.set_padding(0,0);
45
45
 
46
 
            Gtk.HBox slider_layout = new Gtk.HBox(false, CONTROL_SPACING);
47
 
            slider_layout.add(angle_slider);
48
 
 
49
 
            Gtk.HBox button_layout = new Gtk.HBox(false, CONTROL_SPACING);
50
 
            button_layout.add(cancel_button);
51
 
            button_layout.add(reset_button);
52
 
            button_layout.add(ok_button);
53
 
 
54
 
            Gtk.HBox main_layout = new Gtk.HBox(false, 0);
55
 
            main_layout.add(description_label);
56
 
            main_layout.add(slider_layout);
57
 
            main_layout.add(angle_label);
58
 
            main_layout.add(button_layout);
 
46
            Gtk.Box slider_layout = new Gtk.Box(Gtk.Orientation.HORIZONTAL, CONTROL_SPACING);
 
47
            slider_layout.pack_start(angle_slider, true, true, 0);
 
48
 
 
49
            Gtk.Box button_layout = new Gtk.Box(Gtk.Orientation.HORIZONTAL, CONTROL_SPACING);
 
50
            button_layout.pack_start(cancel_button, true, true, 0);
 
51
            button_layout.pack_start(reset_button, true, true, 0);
 
52
            button_layout.pack_start(ok_button, true, true, 0);
 
53
 
 
54
            Gtk.Box main_layout = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
 
55
            main_layout.pack_start(description_label, true, true, 0);
 
56
            main_layout.pack_start(slider_layout, true, true, 0);
 
57
            main_layout.pack_start(angle_label, true, true, 0);
 
58
            main_layout.pack_start(button_layout, true, true, 0);
59
59
 
60
60
            add(main_layout);
61
61
 
145
145
        return false;
146
146
    }
147
147
 
 
148
    public override bool on_keypress(Gdk.EventKey event) {
 
149
        if ((Gdk.keyval_name(event.keyval) == "KP_Enter") ||
 
150
            (Gdk.keyval_name(event.keyval) == "Enter") ||
 
151
            (Gdk.keyval_name(event.keyval) == "Return")) {
 
152
            on_ok_clicked();
 
153
            return true;
 
154
        }
 
155
 
 
156
        if (Gdk.keyval_name(event.keyval) == "Escape") {
 
157
            on_cancel_clicked();
 
158
            return true;
 
159
        }
 
160
 
 
161
        return base.on_keypress(event);
 
162
    }
 
163
 
148
164
    private void prepare_image() {
149
165
        Dimensions canvas_dims = canvas.get_surface_dim();
150
166
        Dimensions viewport = canvas_dims.with_max(TEMP_PIXBUF_SIZE, TEMP_PIXBUF_SIZE);
278
294
    }
279
295
 
280
296
    private void bind_window_handlers() {
 
297
        window.key_press_event.connect(on_keypress);
281
298
        window.ok_button.clicked.connect(on_ok_clicked);
282
299
        window.cancel_button.clicked.connect(on_cancel_clicked);
283
300
        window.angle_slider.value_changed.connect(on_angle_changed);
285
302
    }
286
303
 
287
304
    private void unbind_window_handlers() {
 
305
        window.key_press_event.disconnect(on_keypress);
288
306
        window.ok_button.clicked.disconnect(on_ok_clicked);
289
307
        window.cancel_button.clicked.disconnect(on_cancel_clicked);
290
308
        window.angle_slider.value_changed.disconnect(on_angle_changed);