1 |
/* |
/* |
2 |
* Copyright (C) 2006, 2007 Andreas Persson |
* Copyright (C) 2006-2008 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
44 |
resize.active = false; |
resize.active = false; |
45 |
cursor_is_resize = false; |
cursor_is_resize = false; |
46 |
h = 20; |
h = 20; |
|
w = 800; |
|
47 |
set_flags(Gtk::CAN_FOCUS); |
set_flags(Gtk::CAN_FOCUS); |
48 |
add_events(Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK | |
add_events(Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK | |
49 |
Gdk::POINTER_MOTION_HINT_MASK); |
Gdk::POINTER_MOTION_HINT_MASK); |
70 |
if (!region) return true; |
if (!region) return true; |
71 |
|
|
72 |
// This is where we draw on the window |
// This is where we draw on the window |
73 |
|
int w = get_width(); |
74 |
Glib::RefPtr<Gdk::Window> window = get_window(); |
Glib::RefPtr<Gdk::Window> window = get_window(); |
75 |
Glib::RefPtr<Pango::Context> context = get_pango_context(); |
Glib::RefPtr<Pango::Context> context = get_pango_context(); |
76 |
|
|
372 |
|
|
373 |
bool DimRegionChooser::on_button_press_event(GdkEventButton* event) |
bool DimRegionChooser::on_button_press_event(GdkEventButton* event) |
374 |
{ |
{ |
375 |
|
int w = get_width(); |
376 |
if (region && event->y < nbDimensions * h && |
if (region && event->y < nbDimensions * h && |
377 |
event->x >= label_width && event->x < w) { |
event->x >= label_width && event->x < w) { |
378 |
|
|
455 |
window->get_pointer(x, y, state); |
window->get_pointer(x, y, state); |
456 |
|
|
457 |
if (resize.active) { |
if (resize.active) { |
458 |
|
int w = get_width(); |
459 |
int k = int((x - label_width) * 128.0 / (w - label_width - 1) + 0.5); |
int k = int((x - label_width) * 128.0 / (w - label_width - 1) + 0.5); |
460 |
|
|
461 |
if (k < resize.min) k = resize.min; |
if (k < resize.min) k = resize.min; |
518 |
|
|
519 |
bool DimRegionChooser::is_in_resize_zone(double x, double y) |
bool DimRegionChooser::is_in_resize_zone(double x, double y) |
520 |
{ |
{ |
521 |
|
int w = get_width(); |
522 |
if (region && y < nbDimensions * h && x >= label_width && x < w) { |
if (region && y < nbDimensions * h && x >= label_width && x < w) { |
523 |
int ydim = int(y / h); |
int ydim = int(y / h); |
524 |
int dim; |
int dim; |