home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2006 September / SAN CD 9-2006 CD-ROM 16.iso / pc / Software / Network Telescope Control / NTC-Setup.Exe / Source / ntc_ciel_client_about.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2006-03-24  |  3.9 KB  |  201 lines

  1. unit ntc_ciel_client_about;
  2. {
  3.     Copyright (C) 2004 - 2006 Andrew Sprott
  4.  
  5.     http://astronomy.crysania.co.uk
  6.     astro@trefach.co.uk
  7.  
  8.     This program is free software; you can redistribute it and/or
  9.     modify it under the terms of the GNU General Public License
  10.     as published by the Free Software Foundation; either version 2
  11.     of the License, or (at your option) any later version.
  12.  
  13.     This program is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16.     GNU General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU General Public License
  19.     along with this program; if not, write to the Free Software
  20.     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. }
  22.  
  23. interface
  24.  
  25. uses
  26.     Windows,
  27.     Messages,
  28.     SysUtils,
  29.     Variants,
  30.     Classes,
  31.     Graphics,
  32.     Controls,
  33.     Forms,
  34.     Dialogs,
  35.     StdCtrls,
  36.     ExtCtrls,
  37.     inifiles,
  38.  
  39.     ntc_ciel_client_form;
  40.  
  41. type
  42.     Tscope_about = class(TForm)
  43.         about_panel: TPanel;
  44.         about_icon: TImage;
  45.         copyright_label_1: TLabel;
  46.         copyright_label_2: TLabel;
  47.         copyright_label_3: TLabel;
  48.         copyright_label_4: TLabel;
  49.         message_label_1: TLabel;
  50.         message_label_2: TLabel;
  51.         trefach_url_label: TLabel;
  52.     Label1: TLabel;
  53.     Label2: TLabel;
  54.     Image1: TImage;
  55.  
  56.         { methods }
  57.         procedure formcreate(
  58.             Sender:TObject);
  59.  
  60.         procedure FormShow(
  61.             Sender: TObject);
  62.  
  63.         procedure form_close_query(
  64.                     Sender: TObject;
  65.             var CanClose: Boolean);
  66.  
  67.         procedure adjust;
  68.  
  69.         procedure load_settings;
  70.  
  71.         procedure save_settings;
  72.  
  73.         procedure check_activate(
  74.             Sender: TObject);
  75.  
  76.     private
  77.         { Private declarations }
  78.     public
  79.         { Public declarations }
  80.         { configuration }
  81.         dimensions:dimensions_record;
  82.  
  83.         { events }
  84.         procedure check_visible_and_show_hide(
  85.             sender:tobject);
  86.             
  87.         procedure hide_form;
  88.         procedure show_form;
  89.     end;
  90.  
  91. var
  92.     scope_about: Tscope_about;
  93.  
  94. implementation
  95.  
  96. {$R *.dfm}
  97.  
  98. procedure tscope_about.formcreate(
  99.     Sender:TObject);
  100. begin
  101.     load_settings;
  102.     visible:=false;
  103. end;
  104.  
  105. procedure Tscope_about.FormShow(
  106.     Sender: TObject);
  107. begin
  108.     with dimensions do
  109.         begin
  110.             top:=form_top;
  111.             left:=form_left;
  112.         end;
  113. end;
  114.  
  115. procedure tscope_about.form_close_query(
  116.             Sender: TObject;
  117.     var CanClose: Boolean);
  118. begin
  119.     visible:=false;
  120.     with dimensions do
  121.         begin
  122.             form_top:=top;
  123.             form_left:=left;
  124.         end;
  125.     if ciel_closing then
  126.         canclose:=true
  127.     else
  128.         canclose:=false;
  129. end;
  130.  
  131. procedure tscope_about.adjust;
  132. begin
  133.     with dimensions do
  134.         begin
  135.             form_top:=trunc(form_top/last_screen_height*current_height);
  136.             form_left:=trunc(form_left/last_screen_width*current_width);
  137.         end;
  138.     if visible then
  139.         show;
  140. end;
  141.  
  142. procedure tscope_about.check_visible_and_show_hide(
  143.     sender:tobject);
  144. begin
  145.     if visible then
  146.         hide_form
  147.     else
  148.         show_form;
  149.     scope.show_hide(sender,visible);
  150. end;
  151.  
  152. procedure tscope_about.hide_form;
  153. begin
  154.     with dimensions do
  155.         begin
  156.             form_top:=top;
  157.             form_left:=left;
  158.         end;
  159.     Visible:=false;
  160.     formstyle:=fsnormal;
  161. end;
  162.  
  163. procedure tscope_about.show_form;
  164. begin
  165.     formstyle:=fsstayontop;
  166.     Visible:=true;
  167. end;
  168.  
  169. procedure tscope_about.load_settings;
  170. begin
  171.     ini_file:=tinifile.create(application_path+'ciel.ini');
  172.     with ini_file do
  173.         begin
  174.             { form }
  175.             scope.get_dimensions(scope_about,@dimensions,'about',ini_file);
  176.             left:=dimensions.form_left;
  177.             top:=dimensions.form_top;
  178.             visible:=readbool('about','visible',false);
  179.         end;
  180.     ini_file.free;
  181. end;
  182.  
  183. procedure tscope_about.save_settings;
  184. begin
  185.     with ini_file do
  186.         begin
  187.             { form }
  188.             scope.find_vdu(scope_about,@dimensions);
  189.             scope.write_dimensions(@dimensions,left,top,'about',ini_file);
  190.             writebool('about','visible',visible);
  191.         end;
  192. end;
  193.  
  194. procedure Tscope_about.check_activate(
  195.     Sender: TObject);
  196. begin
  197.     scope.form_activate(scope_about,@dimensions);
  198. end;
  199.  
  200. end.
  201.