home *** CD-ROM | disk | FTP | other *** search
- # $Header: P:/source/ppee/macros/display.pev 1.21 10 Aug 1990 10:07:40 ericj $
-
- ##############################################################################
- #
- # Sage Software - POLYTRON Division
- # 1700 NW 167th Place
- # Beaverton, OR 97006
- #
- # Copyright 1990, Sage Software, Inc.
- #
- # Permission is hereby granted for licensed users of Sage Professional
- # Editor and PolyAwk to copy and modify this source code for their own
- # personal use. These derivative works may be distributed only to other
- # licensed Sage Professional Editor and PolyAwk users. All other usage
- # is prohibited without express written permission from Sage Software.
- #
- ##############################################################################
-
- #### $Workfile: display.pel $: Initialization and command line processing
-
-
-
- #
- # a couple of constants representing the current local height and width
- #
- local currentHeight = 25;
- local currentWidth = 80;
-
- #
- # toggle the current display mode from 25 to 50 or from 50 to 25.
- # if mode == 0, set to 25 line mode, otherwise set to 50 lines.
- #
- global function toggle_display( mode ) {
-
- if( argcount() < 1 ) {
- mode = !(display_height > 25);
- } else {
- mode = !!(0+mode)
- }
-
- currentHeight = display_height;
- currentWidth = display_width;
-
- if ( !xor( currentHeight == 25, mode) )
- if (mode) {
- display_mode( 50 );
- if (display_height == 25)
- display_mode( 43 );
- resize_all_windows( currentHeight,\
- currentWidth, \
- display_height, \
- display_width);
- } else {
- resize_all_windows( currentHeight,\
- currentWidth, \
- 25, \
- 80);
- display_mode( 25 );
- }
- else
- return;
-
-
- if (help_resident) {
- help_install( 0 );
- help_install( 1 );
- }
-
- if (clock_on) {
- toggle_clock( 0 );
- toggle_clock( 1 );
- }
-
- }
-
-
- #
- # Resize all of the windows to fit on the new screen size.
- #
- # We will only handle the situation where the screen size is
- # becoming larger.
- #
- # Only non-system windows are resized
- #
- global function resize_all_windows(currentHeight,currentWidth,newHeight,newWidth) {
- local cw = current_window;
- local sw
- local lr_x
- local lr_y
- local top_y;
- local top_x;
- local new_xext
- local new_yext
- local vpcnt
- local hpcnt
-
- sw = next_window("",1);
-
- do {
- #
- # resize it only if it's not the dialog window and
- # not a system window
- #
- if ( (!and( window_flags, WINDOW_SYSTEM) && and(window_flags, WINDOW_ZOOM)) \
- || (current_window == dialog_window)){
-
- top_x = window_x0;
- top_y = window_y0;
- new_xext = window_width;
- new_yext = window_height;
-
- if (currentHeight != newHeight) {
- if (window_y0 == currentHeight - 1)
- top_y = newHeight - 1;
- else if (window_y0 > 1) {
- vpcnt = (window_y0 * 100) / currentHeight;
- top_y = (vpcnt * newHeight) / 100;
- }
-
- lr_y = window_y0 + window_height;
-
- if (lr_y == currentHeight) {
- new_yext = newHeight - top_y;
- } else if (lr_y == currentHeight - 1) {
- new_yext = newHeight - 1 - top_y;
- } else {
- #
- # resize the y extent proportionally
- #
- vpcnt = (lr_y * 100) / currentHeight;
- new_yext = ((vpcnt * newHeight) / 100) - top_y;
- }
- }
-
- if (currentWidth != newWidth) {
- if (window_x0 != 0) {
- hpcnt = (window_x0 * 100) / currentWidth;
- top_x = (hpcnt * newWidth) / 100;
- }
-
- lr_x = window_x0 + window_width;
-
- if (lr_x == currentWidth) {
- new_xext = newWidth;
- } else {
- #
- # resize the x extent proportionally
- #
- hpcnt = (lr_x * 100) / currentWidth;
- new_xext = ((hpcnt * newWidth) / 100) - top_x;
- }
- }
-
-
- frame_window( top_x, top_y, new_xext, new_yext );
- }
-
- next_window("",1); # next window, include system ones
-
- } while (sw != current_window);
-
- #
- # restore original window
- #
- if ( cw )
- current_window = cw
- }
-