/[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 2626 by schoenebeck, Thu Jun 12 15:12:00 2014 UTC revision 2627 by schoenebeck, Thu Jun 12 16:12:55 2014 UTC
# Line 86  DimRegionChooser::DimRegionChooser(Gtk:: Line 86  DimRegionChooser::DimRegionChooser(Gtk::
86      focus_line = 0;      focus_line = 0;
87      resize.active = false;      resize.active = false;
88      cursor_is_resize = false;      cursor_is_resize = false;
89      h = 20;      h = 24;
90      multiSelectKeyDown = false;      multiSelectKeyDown = false;
91      set_can_focus();      set_can_focus();
92    
# Line 273  bool DimRegionChooser::on_draw(const Cai Line 273  bool DimRegionChooser::on_draw(const Cai
273                  // draw focus rectangle around dimension's label and zones                  // draw focus rectangle around dimension's label and zones
274                  if (has_focus() && focus_line == i) {                  if (has_focus() && focus_line == i) {
275  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
276                      Gdk::Rectangle farea(0, y, 150, 20);                      Gdk::Rectangle farea(0, y, 150, h);
277                      get_style()->paint_focus(get_window(), get_state(), farea,                      get_style()->paint_focus(get_window(), get_state(), farea,
278                                               *this, "",                                               *this, "",
279                                               0, y, label_width, 20);                                               0, y, label_width, h);
280  #else  #else
281                      get_style_context()->render_focus(cr,                      get_style_context()->render_focus(cr,
282                                                        0, y, label_width, 20);                                                        0, y, label_width, h);
283  #endif  #endif
284                  }                  }
285    
# Line 318  bool DimRegionChooser::on_draw(const Cai Line 318  bool DimRegionChooser::on_draw(const Cai
318                      cr->move_to(label_width + 0.5, y + 1);                      cr->move_to(label_width + 0.5, y + 1);
319                      cr->line_to(label_width + 0.5, y + h - 1);                      cr->line_to(label_width + 0.5, y + h - 1);
320                      int prevX = label_width;                      int prevX = label_width;
321                      int prevUpperLimit = 0;                      int prevUpperLimit = -1;
322    
323                      for (int j = 0 ; j < nbZones ; j++) {                      for (int j = 0 ; j < nbZones ; j++) {
324                          // draw dimension zone's borders for custom splits                          // draw dimension zone's borders for custom splits
# Line 346  bool DimRegionChooser::on_draw(const Cai Line 346  bool DimRegionChooser::on_draw(const Cai
346                          // as numeric value to the user                          // as numeric value to the user
347                          {                          {
348                              Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(context);                              Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(context);
349                              layout->set_text(Glib::Ascii::dtostr(prevUpperLimit));                              layout->set_text(Glib::Ascii::dtostr(prevUpperLimit+1));
350                              Gdk::Cairo::set_source_rgba(cr, black);                              Gdk::Cairo::set_source_rgba(cr, black);
351                              Pango::Rectangle rect = layout->get_logical_extents();                              Pango::Rectangle rect = layout->get_logical_extents();
352                              // get the text dimensions                              // get the text dimensions
353                              int text_width, text_height;                              int text_width, text_height;
354                              layout->get_pixel_size(text_width, text_height);                              layout->get_pixel_size(text_width, text_height);
355                              // move text to the left end of the dimension zone                              // move text to the left end of the dimension zone
356                              cr->move_to(prevX + 3, y + 1);                              cr->move_to(prevX + 3, y + (h - text_height) / 2);
357  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2
358                              pango_cairo_show_layout(cr->cobj(), layout->gobj());                              pango_cairo_show_layout(cr->cobj(), layout->gobj());
359  #else  #else
# Line 371  bool DimRegionChooser::on_draw(const Cai Line 371  bool DimRegionChooser::on_draw(const Cai
371                              int text_width, text_height;                              int text_width, text_height;
372                              layout->get_pixel_size(text_width, text_height);                              layout->get_pixel_size(text_width, text_height);
373                              // move text to the left end of the dimension zone                              // move text to the left end of the dimension zone
374                              cr->move_to(x - 3 - text_width, y + 1);                              cr->move_to(x - 3 - text_width, y + (h - text_height) / 2);
375  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2
376                              pango_cairo_show_layout(cr->cobj(), layout->gobj());                              pango_cairo_show_layout(cr->cobj(), layout->gobj());
377  #else  #else
# Line 413  bool DimRegionChooser::on_draw(const Cai Line 413  bool DimRegionChooser::on_draw(const Cai
413                                  int text_width, text_height;                                  int text_width, text_height;
414                                  layout->get_pixel_size(text_width, text_height);                                  layout->get_pixel_size(text_width, text_height);
415                                  // move text to the left end of the dimension zone                                  // move text to the left end of the dimension zone
416                                  cr->move_to(prevX + 3, y + 1);                                  cr->move_to(prevX + 3, y + (h - text_height) / 2);
417  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2
418                                  pango_cairo_show_layout(cr->cobj(), layout->gobj());                                  pango_cairo_show_layout(cr->cobj(), layout->gobj());
419  #else  #else
# Line 431  bool DimRegionChooser::on_draw(const Cai Line 431  bool DimRegionChooser::on_draw(const Cai
431                                  int text_width, text_height;                                  int text_width, text_height;
432                                  layout->get_pixel_size(text_width, text_height);                                  layout->get_pixel_size(text_width, text_height);
433                                  // move text to the left end of the dimension zone                                  // move text to the left end of the dimension zone
434                                  cr->move_to(x - 3 - text_width, y + 1);                                  cr->move_to(x - 3 - text_width, y + (h - text_height) / 2);
435  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2
436                                  pango_cairo_show_layout(cr->cobj(), layout->gobj());                                  pango_cairo_show_layout(cr->cobj(), layout->gobj());
437  #else  #else
# Line 469  void DimRegionChooser::set_region(gig::R Line 469  void DimRegionChooser::set_region(gig::R
469          }          }
470      }      }
471      dimregion_selected();      dimregion_selected();
472      set_size_request(800, region ? nbDimensions * 20 : 0);      set_size_request(800, region ? nbDimensions * h : 0);
473    
474      labels_changed = true;      labels_changed = true;
475      queue_resize();      queue_resize();

Legend:
Removed from v.2626  
changed lines
  Added in v.2627

  ViewVC Help
Powered by ViewVC