Mercurial > hg > octave-nkf
comparison src/graphics.cc @ 13799:760e4e88dba3
convert units for figure positions
* graphics.h.in, graphics.cc (convert_position, screen_size_pixels):
Now extern.
* __init_fltk__.cc (figure_manager::do_new_window): Convert specified
position to pixels.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 03 Nov 2011 04:33:25 -0400 |
parents | 1e81e2e30af3 |
children | 195ff3561152 |
comparison
equal
deleted
inserted
replaced
13798:718f78b01de1 | 13799:760e4e88dba3 |
---|---|
409 } | 409 } |
410 | 410 |
411 return new_font_size; | 411 return new_font_size; |
412 } | 412 } |
413 | 413 |
414 static Matrix | 414 Matrix |
415 convert_position (const Matrix& pos, const caseless_str& from_units, | 415 convert_position (const Matrix& pos, const caseless_str& from_units, |
416 const caseless_str& to_units, | 416 const caseless_str& to_units, const Matrix& parent_dim) |
417 const Matrix& parent_dim = Matrix (1, 2, 0.0)) | |
418 { | 417 { |
419 Matrix retval (1, pos.numel ()); | 418 Matrix retval (1, pos.numel ()); |
420 double res = 0; | 419 double res = 0; |
421 bool is_rectangle = (pos.numel () == 4); | 420 bool is_rectangle = (pos.numel () == 4); |
422 bool is_2d = (pos.numel () == 2); | 421 bool is_2d = (pos.numel () == 2); |
634 | 633 |
635 return retval; | 634 return retval; |
636 } | 635 } |
637 | 636 |
638 // This function always returns the screensize in pixels | 637 // This function always returns the screensize in pixels |
639 static Matrix | 638 Matrix |
640 screen_size_pixels (void) | 639 screen_size_pixels (void) |
641 { | 640 { |
642 graphics_object obj = gh_manager::get_object (0); | 641 graphics_object obj = gh_manager::get_object (0); |
643 Matrix sz = obj.get ("screensize").matrix_value (); | 642 Matrix sz = obj.get ("screensize").matrix_value (); |
644 return convert_position (sz, obj.get ("units").string_value (), "pixels", sz.extract_n (0, 2, 1, 2)).extract_n (0, 2, 1, 2); | 643 return convert_position (sz, obj.get ("units").string_value (), "pixels", sz.extract_n (0, 2, 1, 2)).extract_n (0, 2, 1, 2); |