Ignore:
Timestamp:
Jan 7, 2007, 10:01:36 AM (19 years ago)
Author:
RBRi
Message:

obsolete source removed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/StartupUnit.pas

    r43 r46  
    173173end;
    174174
    175 // Extract a single element of a window position spec
    176 // - take a value from comma-separated list
    177 // - convert to numeric
    178 // - if the number ends with P then take as
    179 //   a percentage of given dimension
    180 Function ExtractPositionElement( Var ParamValue: string;
    181                                  ScreenDimension: longint ): longint;
    182 var
    183   Element: string;
    184 begin
    185   Element := ExtractNextValue( ParamValue, ',' );
    186   if Element = '' then
    187     raise Exception.Create( 'Missing position element' );
    188   if StrEnds( 'P', Element ) then
    189   begin
    190     Delete( Element, Length( Element ), 1 );
    191     if Element = '' then
    192       raise Exception.Create( 'Missing position element' );
    193     Result := StrToInt( Element );
    194     if Result < 0 then
    195       Result := 0;
    196     if Result > 100 then
    197       Result := 100;
    198     Result := Round( Result / 100 * ScreenDimension );
    199   end
    200   else
    201   begin
    202     Result := StrToInt( Element );
    203   end;
    204 end;
    205 
    206 Function SystemMetrics(sm:LONG):LongInt;
    207 Begin
    208   Result := WinQuerySysValue(HWND_DESKTOP,sm);
    209 end;
    210 
    211 // Extract a specified window position:
    212 // X,Y,W,H
    213 Function ExtractPositionSpec( ParamValue: string;
    214                               Var Position: TWindowPosition ): boolean;
    215 begin
    216   try
    217     Position.Left := ExtractPositionElement( ParamValue, SystemMetrics(SV_CXSCREEN) );
    218     Position.Bottom := ExtractPositionElement( ParamValue, SystemMetrics(SV_CYSCREEN) );
    219     Position.Width := ExtractPositionElement( ParamValue, SystemMetrics(SV_CXSCREEN) );
    220     if Position.Width < 50 then
    221       Position.Width := 50;
    222     Position.Height := ExtractPositionElement( ParamValue, SystemMetrics(SV_CYSCREEN) );
    223     if Position.Height < 50 then
    224 
    225       Position.Height := 50;
    226     Result := true;
    227   except
    228     Result := false;
    229   end;
    230 end;
    231 
    232 
    233175// If another instance already has the files open
    234176// activate it and return true.
Note: See TracChangeset for help on using the changeset viewer.