/[svn]/gigedit/trunk/src/gigedit/dimregionchooser.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/dimregionchooser.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1622 by persson, Sat Dec 1 10:21:07 2007 UTC revision 1623 by persson, Fri Jan 4 19:42:45 2008 UTC
# Line 1  Line 1 
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
# Line 44  DimRegionChooser::DimRegionChooser() Line 44  DimRegionChooser::DimRegionChooser()
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);
# Line 71  bool DimRegionChooser::on_expose_event(G Line 70  bool DimRegionChooser::on_expose_event(G
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    
# Line 372  bool DimRegionChooser::on_button_release Line 372  bool DimRegionChooser::on_button_release
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    
# Line 454  bool DimRegionChooser::on_motion_notify_ Line 455  bool DimRegionChooser::on_motion_notify_
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;
# Line 516  bool DimRegionChooser::on_motion_notify_ Line 518  bool DimRegionChooser::on_motion_notify_
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;

Legend:
Removed from v.1622  
changed lines
  Added in v.1623

  ViewVC Help
Powered by ViewVC