Changeset 4479


Ignore:
Timestamp:
2003-06-04T16:17:50+12:00 (21 years ago)
Author:
mdewsnip
Message:

Now remembers window location as well as size (storing in configuration file).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r4397 r4479  
    209209        }
    210210
    211                 // Size the screen
    212         Dimension temp = config.getDimension("general.size", true);
    213         if(temp != null) {
    214         size = temp;
    215         }
    216         if (size.height > config.screen_size.height) {
    217         size.setSize(size.width, config.screen_size.height);
    218         }
    219         if (size.width > config.screen_size.width) {
    220         size.setSize(config.screen_size.width, size.height);
    221         }
     211        // Size and place the frame on the screen
     212        Rectangle bounds = config.getBounds("general.bounds", true);
     213        if (bounds != null) {
     214        size = bounds.getSize();
     215        }
     216        // Ensure width and height are reasonable
     217        if (size.width < 640) {
     218        size.width = 640;
     219        }
     220        else if (size.width > config.screen_size.width) {
     221        size.width = config.screen_size.width;
     222        }
     223        if (size.height < 480) {
     224        size.height = 480;
     225        }
     226        else if (size.height > config.screen_size.height) {
     227        size.height = config.screen_size.height;
     228        }
    222229                // Set default font
    223230        setUIFont(config.getFont("general.font", true), config.getFont("general.tooltip_font", true));
     
    245252
    246253                // Center the screen, if this is do-able (not under most linux window managers apparently. In fact you're lucky if they listen to any of your screen size requests).
    247         g_man.setLocation((config.screen_size.width - size.width) / 2, (config.screen_size.height - size.height) / 2);
     254        // g_man.setLocation((config.screen_size.width - size.width) / 2, (config.screen_size.height - size.height) / 2);
     255        g_man.setBounds(bounds);
    248256        g_man.setVisible(true);
    249257                // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
     
    304312        assoc_man = null;
    305313    }
    306     // Check the current size of the Gatherer, and if its reasonable (ie greater than minsize) then store it for next time.
    307     Dimension size = g_man.getSize();
    308     if(size.width > 100 && size.height > 100) {
    309         config.setDimension("general.size", true, size);
    310     }
     314
     315    // Store the current position and size (if reasonable) of the Gatherer for next time
     316    Rectangle bounds = g_man.getBounds();
     317    config.setBounds("general.bounds", true, bounds);
    311318
    312319    // Save configuration.
Note: See TracChangeset for help on using the changeset viewer.