Fix issue which prevents window from downscaling
Replace Fixed-Container by Layout-Container to disconnects the window size from the content size. Otherwise the window size can be increased but not decreased.
This commit is contained in:
parent
6d347d1729
commit
24ae37e874
|
@ -37,7 +37,6 @@ namespace NeoLayoutViewer {
|
|||
this._width = this.winMain.get_allocated_width();
|
||||
this._height = this.winMain.get_allocated_height();
|
||||
this.set_size_request(_width, _height);
|
||||
this.set_size(_width, _height);
|
||||
|
||||
this.color_event_boxes = (winMain.config.get("color_event_boxes") == "1");
|
||||
|
||||
|
@ -48,8 +47,11 @@ namespace NeoLayoutViewer {
|
|||
|
||||
private void main_resized(){
|
||||
|
||||
int width = this.winMain.get_allocated_width();
|
||||
int height = this.winMain.get_allocated_height();
|
||||
int width;
|
||||
int height;
|
||||
//width = this.winMain.get_allocated_width();
|
||||
//height = this.winMain.get_allocated_height();
|
||||
this.winMain.get_size(out width, out height);
|
||||
|
||||
if( this._width == width && this._height == height ){
|
||||
return; // to avoid infinite resize live lock...
|
||||
|
@ -63,11 +65,10 @@ namespace NeoLayoutViewer {
|
|||
this._width = width;
|
||||
this._height = height;
|
||||
|
||||
|
||||
// Propagate new window width/height to this grid. (Redundant?!)
|
||||
// Propagate new window width/height to this grid.
|
||||
this.set_size_request(width, height);
|
||||
|
||||
debug("Move cells");
|
||||
debug("Rescale cells");
|
||||
move_and_scale_cells();
|
||||
|
||||
|
||||
|
@ -80,11 +81,14 @@ namespace NeoLayoutViewer {
|
|||
*/
|
||||
public void generateCells() {
|
||||
|
||||
// Dimensions of unscaled background image
|
||||
double width_unscaled = (double) winMain.get_unscaled_width();
|
||||
double height_unscaled = (double) winMain.get_unscaled_height();
|
||||
|
||||
int width, height;
|
||||
winMain.get_size(out width, out height);
|
||||
// Desirered target size
|
||||
width = this._width;
|
||||
height = this._height;
|
||||
|
||||
double scaleX = width/width_unscaled;
|
||||
double scaleY = height/height_unscaled;
|
||||
|
|
|
@ -258,20 +258,22 @@ namespace NeoLayoutViewer {
|
|||
int win_width = get_image_width_for_monitor(this.monitor_w);
|
||||
int win_height = (backgroundH_unscaled * win_width)/ backgroundW_unscaled;
|
||||
|
||||
//this.set_size_request(1, 1);
|
||||
this.resize(win_width, win_height);
|
||||
this.set_default_size(win_width, win_height);
|
||||
|
||||
image.show();
|
||||
var fixed = new Fixed();
|
||||
fixed.put(this.image, 0, 0);
|
||||
var layout = new Layout();
|
||||
layout.put(this.image, 0, 0);
|
||||
|
||||
#if _NO_WIN
|
||||
this.key_overlay = new KeyOverlay(this);
|
||||
this.key_overlay.show();
|
||||
fixed.put(this.key_overlay, 0, 0);
|
||||
layout.put(this.key_overlay, 0, 0);
|
||||
#endif
|
||||
|
||||
add(fixed);
|
||||
fixed.show();
|
||||
add(layout);
|
||||
layout.show();
|
||||
|
||||
//Fenstereigenschaften setzen
|
||||
this.key_press_event.connect(on_key_pressed);
|
||||
|
@ -400,7 +402,7 @@ namespace NeoLayoutViewer {
|
|||
|
||||
|
||||
// Check images of layers need to be rescaled
|
||||
if (monitor_rect_dest.width != this.monitor_w && true){
|
||||
if (monitor_rect_dest.width != this.monitor_w) {
|
||||
this.monitor_w = monitor_rect_dest.width;
|
||||
|
||||
int width;
|
||||
|
@ -408,7 +410,8 @@ namespace NeoLayoutViewer {
|
|||
width = get_image_width_for_monitor(this.monitor_w);
|
||||
height = get_unscaled_height() * width / get_unscaled_width();
|
||||
|
||||
this.resize(width, height);
|
||||
//this.resize(width, height);
|
||||
this.set_default_size(width, height);
|
||||
}
|
||||
|
||||
int x, y, w, h;
|
||||
|
|
|
@ -58,8 +58,11 @@ namespace NeoLayoutViewer {
|
|||
private void main_resized(){
|
||||
|
||||
// Get new window size
|
||||
int win_width2 = this.winMain.get_allocated_width();
|
||||
int win_height2 = this.winMain.get_allocated_height();
|
||||
int win_width2;
|
||||
int win_height2;
|
||||
//win_width2 = this.winMain.get_allocated_width();
|
||||
//win_height2 = this.winMain.get_allocated_height();
|
||||
this.winMain.get_size(out win_width2, out win_height2);
|
||||
|
||||
if (win_width == win_width2 && win_height == win_height2) {
|
||||
//debug(@"(ScalingImage $(this.id)) same width $(win_width)");
|
||||
|
|
Loading…
Reference in New Issue