Changeset 18


Ignore:
Timestamp:
Sep 27, 2011, 3:49:24 PM (13 years ago)
Author:
george
Message:
  • Added: Persistent window position and size stored to registry.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/UMainForm.lfm

    r16 r18  
    88  ClientWidth = 514
    99  Menu = MainMenu1
     10  OnClose = FormClose
    1011  OnCreate = FormCreate
    1112  OnDeactivate = FormDeactivate
     13  OnDestroy = FormDestroy
    1214  OnKeyDown = FormKeyDown
    1315  OnKeyUp = FormKeyUp
    1416  OnShow = FormShow
    1517  LCLVersion = '0.9.31'
    16   WindowState = wsMaximized
    1718  object StatusBar1: TStatusBar
    1819    Left = 0
  • trunk/UMainForm.pas

    r16 r18  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    9   ComCtrls, Menus, ActnList, UCore, UPlatform, Math, DateUtils, GraphType;
     9  ComCtrls, Menus, ActnList, UCore, UPlatform, Math, DateUtils, GraphType,
     10  UPersistentForm, UApplicationInfo;
    1011
    1112type
     
    3940    procedure AShowMapExecute(Sender: TObject);
    4041    procedure AShowRawImageDescExecute(Sender: TObject);
     42    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    4143    procedure FormCreate(Sender: TObject);
    4244    procedure FormDeactivate(Sender: TObject);
     45    procedure FormDestroy(Sender: TObject);
    4346    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    4447    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     
    5558    Drawing: Boolean;
    5659  public
    57     { public declarations }
     60    PersistentForm: TPersistentForm;
    5861  end;
    5962
     
    9699procedure TMainForm.FormCreate(Sender: TObject);
    97100begin
     101  PersistentForm := TPersistentForm.Create;
     102  PersistentForm.RegistryKey := '\Software\' + ApplicationInfo.CompanyName + '\' + ApplicationInfo.Name;
     103
    98104  Application.OnDeactivate := FormDeactivate;
    99105  Randomize;
     
    138144begin
    139145  Engine.KeyBoard.ClearAll;
     146end;
     147
     148procedure TMainForm.FormDestroy(Sender: TObject);
     149begin
     150  PersistentForm.Free;
    140151end;
    141152
     
    178189
    179190procedure TMainForm.AShowRawImageDescExecute(Sender: TObject);
    180 var
    181   List: TStringList;
    182 begin
    183   with Image1.Picture.Bitmap.RawImage, Description do
    184   try
    185     List := TStringList.Create;
    186     with List do begin
    187       Add('Format: ' + RawImageColorFormatNames[Format]);
    188       Add('Width: ' + IntToStr(Width));
    189       Add('Height: ' + IntToStr(Height));
    190       Add('Depth: ' + IntToStr(Depth));
    191       Add('BitOrder: ' + RawImageBitOrderNames[BitOrder]);
    192       Add('ByteOrder: ' + RawImageByteOrderNames[ByteOrder]);
    193       Add('LineOrder: ' + RawImageLineOrderNames[LineOrder]);
    194       Add('LineEnd: ' + RawImageLineEndNames[LineEnd]);
    195       Add('BitsPerPixel: ' + IntToStr(BitsPerPixel));
    196       Add('RedPrec: ' + IntToStr(RedPrec));
    197       Add('RedShift: ' + IntToStr(RedShift));
    198       Add('GreenPrec: ' + IntToStr(GreenPrec));
    199       Add('GreenShift: ' + IntToStr(GreenShift));
    200       Add('BluePrec: ' + IntToStr(BluePrec));
    201       Add('BlueShift: ' + IntToStr(BlueShift));
    202       Add('AlphaPrec: ' + IntToStr(AlphaPrec));
    203       Add('AlphaShift: ' + IntToStr(AlphaShift));
    204     end;
    205     ShowMessage(List.Text);
    206   finally
    207     List.Free;
    208   end;
     191begin
     192  ShowMessage(Image1.Picture.Bitmap.RawImage.Description.AsString);
     193end;
     194
     195procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     196begin
     197  PersistentForm.Save(Self);
    209198end;
    210199
     
    229218procedure TMainForm.FormShow(Sender: TObject);
    230219begin
     220  PersistentForm.Load(Self);
    231221end;
    232222
  • trunk/tunneler.lpi

    r16 r18  
    3333      <Item1>
    3434        <PackageName Value="LCLBase"/>
    35         <MinVersion Major="1" Release="1" Valid="True"/>
     35        <MinVersion Major="1" Valid="True" Release="1"/>
    3636      </Item1>
    3737      <Item2>
     
    4242      </Item3>
    4343    </RequiredPackages>
    44     <Units Count="53">
     44    <Units Count="59">
    4545      <Unit0>
    4646        <Filename Value="tunneler.lpr"/>
     
    5050        <TopLine Value="1"/>
    5151        <CursorPos X="15" Y="4"/>
    52         <UsageCount Value="83"/>
     52        <UsageCount Value="85"/>
    5353      </Unit0>
    5454      <Unit1>
     
    5959        <UnitName Value="UMainForm"/>
    6060        <IsVisibleTab Value="True"/>
    61         <EditorIndex Value="4"/>
    62         <WindowIndex Value="0"/>
    63         <TopLine Value="190"/>
    64         <CursorPos X="1" Y="206"/>
    65         <UsageCount Value="83"/>
     61        <EditorIndex Value="5"/>
     62        <WindowIndex Value="0"/>
     63        <TopLine Value="89"/>
     64        <CursorPos X="48" Y="102"/>
     65        <UsageCount Value="85"/>
    6666        <Loaded Value="True"/>
    6767        <LoadedDesigner Value="True"/>
     
    7373        <EditorIndex Value="0"/>
    7474        <WindowIndex Value="0"/>
    75         <TopLine Value="885"/>
    76         <CursorPos X="40" Y="895"/>
    77         <UsageCount Value="83"/>
     75        <TopLine Value="878"/>
     76        <CursorPos X="32" Y="395"/>
     77        <UsageCount Value="85"/>
    7878        <Loaded Value="True"/>
    7979      </Unit2>
     
    135135        <UnitName Value="Graphics"/>
    136136        <WindowIndex Value="0"/>
    137         <TopLine Value="1433"/>
    138         <CursorPos X="3" Y="1449"/>
    139         <UsageCount Value="5"/>
     137        <TopLine Value="1314"/>
     138        <CursorPos X="42" Y="1327"/>
     139        <UsageCount Value="10"/>
    140140      </Unit10>
    141141      <Unit11>
     
    261261        <ResourceBaseClass Value="Form"/>
    262262        <UnitName Value="UMapForm"/>
    263         <EditorIndex Value="3"/>
     263        <EditorIndex Value="4"/>
    264264        <WindowIndex Value="0"/>
    265265        <TopLine Value="6"/>
    266266        <CursorPos X="20" Y="39"/>
    267         <UsageCount Value="62"/>
     267        <UsageCount Value="64"/>
    268268        <Loaded Value="True"/>
    269269      </Unit27>
     
    392392        <IsPartOfProject Value="True"/>
    393393        <UnitName Value="UPlatform"/>
    394         <UsageCount Value="42"/>
     394        <UsageCount Value="44"/>
    395395      </Unit44>
    396396      <Unit45>
     
    437437        <IsPartOfProject Value="True"/>
    438438        <UnitName Value="URectangle"/>
    439         <EditorIndex Value="2"/>
     439        <EditorIndex Value="3"/>
    440440        <WindowIndex Value="0"/>
    441441        <TopLine Value="120"/>
    442442        <CursorPos X="44" Y="150"/>
    443         <UsageCount Value="27"/>
     443        <UsageCount Value="29"/>
    444444        <Loaded Value="True"/>
    445445      </Unit50>
     
    454454        <Filename Value="../../FreePascalManager/trunk/Instance/1/Lazarus/lcl/graphtype.pp"/>
    455455        <UnitName Value="GraphType"/>
     456        <WindowIndex Value="0"/>
     457        <TopLine Value="520"/>
     458        <CursorPos X="35" Y="531"/>
     459        <UsageCount Value="11"/>
     460      </Unit52>
     461      <Unit53>
     462        <Filename Value="Common/UPersistentForm.pas"/>
     463        <IsPartOfProject Value="True"/>
     464        <UnitName Value="UPersistentForm"/>
    456465        <EditorIndex Value="1"/>
    457466        <WindowIndex Value="0"/>
    458         <TopLine Value="66"/>
    459         <CursorPos X="20" Y="79"/>
     467        <TopLine Value="69"/>
     468        <CursorPos X="3" Y="90"/>
     469        <UsageCount Value="22"/>
     470        <Loaded Value="True"/>
     471      </Unit53>
     472      <Unit54>
     473        <Filename Value="UApplicationInfo.pas"/>
     474        <IsPartOfProject Value="True"/>
     475        <UnitName Value="UApplicationInfo"/>
     476        <EditorIndex Value="2"/>
     477        <WindowIndex Value="0"/>
     478        <TopLine Value="42"/>
     479        <CursorPos X="29" Y="58"/>
     480        <UsageCount Value="22"/>
     481        <Loaded Value="True"/>
     482      </Unit54>
     483      <Unit55>
     484        <Filename Value="Common/URegistry.pas"/>
     485        <IsPartOfProject Value="True"/>
     486        <UnitName Value="URegistry"/>
     487        <UsageCount Value="21"/>
     488      </Unit55>
     489      <Unit56>
     490        <Filename Value="../../FreePascalManager/trunk/Instance/1/FPC/rtl/objpas/sysutils/sysstrh.inc"/>
     491        <WindowIndex Value="0"/>
     492        <TopLine Value="71"/>
     493        <CursorPos X="10" Y="84"/>
    460494        <UsageCount Value="10"/>
    461         <Loaded Value="True"/>
    462       </Unit52>
     495      </Unit56>
     496      <Unit57>
     497        <Filename Value="../../FreePascalManager/trunk/Instance/1/FPC/rtl/objpas/sysutils/sysstr.inc"/>
     498        <WindowIndex Value="0"/>
     499        <TopLine Value="167"/>
     500        <CursorPos X="3" Y="169"/>
     501        <UsageCount Value="10"/>
     502      </Unit57>
     503      <Unit58>
     504        <Filename Value="../../FreePascalManager/trunk/Instance/1/Lazarus/lcl/include/rasterimage.inc"/>
     505        <WindowIndex Value="0"/>
     506        <TopLine Value="466"/>
     507        <CursorPos X="17" Y="470"/>
     508        <UsageCount Value="10"/>
     509      </Unit58>
    463510    </Units>
    464     <JumpHistory Count="25" HistoryIndex="24">
     511    <JumpHistory Count="16" HistoryIndex="15">
    465512      <Position1>
    466         <Filename Value="UCore.pas"/>
    467         <Caret Line="102" Column="1" TopLine="72"/>
     513        <Filename Value="UMainForm.pas"/>
     514        <Caret Line="191" Column="29" TopLine="175"/>
    468515      </Position1>
    469516      <Position2>
    470         <Filename Value="UCore.pas"/>
    471         <Caret Line="420" Column="8" TopLine="391"/>
     517        <Filename Value="UMainForm.pas"/>
     518        <Caret Line="188" Column="5" TopLine="180"/>
    472519      </Position2>
    473520      <Position3>
    474         <Filename Value="UCore.pas"/>
    475         <Caret Line="379" Column="42" TopLine="361"/>
     521        <Filename Value="UMainForm.pas"/>
     522        <Caret Line="191" Column="45" TopLine="181"/>
    476523      </Position3>
    477524      <Position4>
    478         <Filename Value="UCore.pas"/>
    479         <Caret Line="453" Column="17" TopLine="433"/>
     525        <Filename Value="Common/UPersistentForm.pas"/>
     526        <Caret Line="90" Column="3" TopLine="69"/>
    480527      </Position4>
    481528      <Position5>
    482         <Filename Value="UCore.pas"/>
    483         <Caret Line="480" Column="88" TopLine="447"/>
     529        <Filename Value="UMainForm.pas"/>
     530        <Caret Line="10" Column="36" TopLine="1"/>
    484531      </Position5>
    485532      <Position6>
    486         <Filename Value="UCore.pas"/>
    487         <Caret Line="521" Column="66" TopLine="496"/>
     533        <Filename Value="UMainForm.pas"/>
     534        <Caret Line="99" Column="54" TopLine="86"/>
    488535      </Position6>
    489536      <Position7>
    490         <Filename Value="UCore.pas"/>
    491         <Caret Line="935" Column="26" TopLine="924"/>
     537        <Filename Value="UMainForm.pas"/>
     538        <Caret Line="46" Column="30" TopLine="29"/>
    492539      </Position7>
    493540      <Position8>
    494         <Filename Value="UCore.pas"/>
    495         <Caret Line="895" Column="40" TopLine="885"/>
     541        <Filename Value="UMainForm.pas"/>
     542        <Caret Line="147" Column="22" TopLine="145"/>
    496543      </Position8>
    497544      <Position9>
    498         <Filename Value="../../FreePascalManager/trunk/Instance/1/Lazarus/lcl/graphtype.pp"/>
    499         <Caret Line="189" Column="31" TopLine="176"/>
     545        <Filename Value="UMainForm.pas"/>
     546        <Caret Line="246" Column="1" TopLine="229"/>
    500547      </Position9>
    501548      <Position10>
    502549        <Filename Value="UMainForm.pas"/>
    503         <Caret Line="28" Column="90" TopLine="19"/>
     550        <Caret Line="230" Column="63" TopLine="220"/>
    504551      </Position10>
    505552      <Position11>
    506         <Filename Value="UMainForm.pas"/>
    507         <Caret Line="29" Column="90" TopLine="20"/>
     553        <Filename Value="UCore.pas"/>
     554        <Caret Line="895" Column="41" TopLine="882"/>
    508555      </Position11>
    509556      <Position12>
    510         <Filename Value="UMainForm.pas"/>
    511         <Caret Line="30" Column="90" TopLine="21"/>
     557        <Filename Value="UCore.pas"/>
     558        <Caret Line="895" Column="39" TopLine="888"/>
    512559      </Position12>
    513560      <Position13>
    514         <Filename Value="UMainForm.pas"/>
    515         <Caret Line="31" Column="90" TopLine="21"/>
     561        <Filename Value="UCore.pas"/>
     562        <Caret Line="947" Column="36" TopLine="924"/>
    516563      </Position13>
    517564      <Position14>
    518         <Filename Value="UMainForm.pas"/>
    519         <Caret Line="8" Column="30" TopLine="1"/>
     565        <Filename Value="UCore.pas"/>
     566        <Caret Line="895" Column="40" TopLine="876"/>
    520567      </Position14>
    521568      <Position15>
    522         <Filename Value="UMainForm.pas"/>
    523         <Caret Line="181" Column="46" TopLine="179"/>
     569        <Filename Value="UCore.pas"/>
     570        <Caret Line="894" Column="24" TopLine="876"/>
    524571      </Position15>
    525572      <Position16>
    526         <Filename Value="../../FreePascalManager/trunk/Instance/1/Lazarus/lcl/graphtype.pp"/>
    527         <Caret Line="189" Column="28" TopLine="176"/>
     573        <Filename Value="UCore.pas"/>
     574        <Caret Line="151" Column="25" TopLine="138"/>
    528575      </Position16>
    529       <Position17>
    530         <Filename Value="UMainForm.pas"/>
    531         <Caret Line="188" Column="25" TopLine="180"/>
    532       </Position17>
    533       <Position18>
    534         <Filename Value="../../FreePascalManager/trunk/Instance/1/Lazarus/lcl/graphtype.pp"/>
    535         <Caret Line="66" Column="23" TopLine="53"/>
    536       </Position18>
    537       <Position19>
    538         <Filename Value="../../FreePascalManager/trunk/Instance/1/Lazarus/lcl/graphtype.pp"/>
    539         <Caret Line="114" Column="33" TopLine="93"/>
    540       </Position19>
    541       <Position20>
    542         <Filename Value="UMainForm.pas"/>
    543         <Caret Line="183" Column="45" TopLine="180"/>
    544       </Position20>
    545       <Position21>
    546         <Filename Value="UMainForm.pas"/>
    547         <Caret Line="187" Column="43" TopLine="180"/>
    548       </Position21>
    549       <Position22>
    550         <Filename Value="UMainForm.pas"/>
    551         <Caret Line="183" Column="46" TopLine="174"/>
    552       </Position22>
    553       <Position23>
    554         <Filename Value="UMainForm.pas"/>
    555         <Caret Line="9" Column="74" TopLine="1"/>
    556       </Position23>
    557       <Position24>
    558         <Filename Value="UMainForm.pas"/>
    559         <Caret Line="191" Column="29" TopLine="175"/>
    560       </Position24>
    561       <Position25>
    562         <Filename Value="UMainForm.pas"/>
    563         <Caret Line="188" Column="5" TopLine="180"/>
    564       </Position25>
    565576    </JumpHistory>
    566577  </ProjectOptions>
  • trunk/tunneler.lpr

    r11 r18  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UMainForm, UCore, TemplateGenerics, UMapForm, UPlatform, URectangle
     10  Forms, UMainForm, UCore, TemplateGenerics, UMapForm, UPlatform,
     11  UApplicationInfo, URectangle, UPersistentForm, URegistry
    1112  { you can add units after this };
    1213
Note: See TracChangeset for help on using the changeset viewer.