wszyscy myślą, że to dno. ale na dnie tak nie wieje...


Załadowanie ustawień kalkulatora wykonywane jest przez funkcję
ReadSettingsFromRegistry(); jej treść przedstawiamy na wydruku 3.42.

Wydruk 3.42. Odczyt ustawień aplikacji z Rejestru

void __fastcall TMainForm::ReadSettingsFromRegistry(const
std::auto_ptr<TRegIniFile>& Registry)
{
// Panel LCD

// - Kolor
LCDPanel->Color
= static_cast<TColor>(Registry->ReadInteger("Settings\\Display\\Color",
"SurroundColor",
LCDPanel->Color));
BackgroundPanel->Color
= static_cast<TColor>(Registry->ReadInteger("Settings\\Display\\Color",
"BackgroundColor",
BackgroundPanel->Color));
ExponentViewColor = BackgroundPanel->Color;

ExponentEditColor
= static_cast<TColor>(Registry->ReadInteger("Settings\\Display\\Color",
"ExponentColor",
ExponentEditColor));


// - Dokowanie
LCDPanel->UndockWidth
= Registry->ReadInteger("Settings\\Display","UndockWidth",
LCDPanel->UndockWidth);

if(LCDPanel->UndockWidth > Screen->Width)
{
LCDPanel->UndockWidth = Screen->Width;
}

LCDPanel->UndockHeight
= Registry->ReadInteger("Settings\\Display","UndockHeight",
LCDPanel->UndockHeight);

bool Floating = Registry->ReadBool("Settings\\Display","Floating",
LCDPanel->Floating);

if(Floating)
{
int UndockLeft = Registry->ReadInteger("Settings\\Display",
"UndockLeft",
LCDPanel->Left);

int UndockTop = Registry->ReadInteger("Settings\\Display",
"UndockTop",
LCDPanel->Top);

TRect UndockedRect(UndockLeft,
UndockTop,
UndockLeft + LCDPanel->UndockWidth,
UndockTop + LCDPanel->UndockHeight);

int UndockRight = Registry->ReadInteger("Settings\\Display",
"UndockRight",
UndockedRect.Right);

int UndockBottom = Registry->ReadInteger("Settings\\Display",
"UndockBottom",
UndockedRect.Bottom);

if(UndockRight > Screen->Width)
{
int Offset = UndockRight - Screen->Width;
UndockedRect.Right -= Offset;
UndockedRect.Left -= Offset;
if(UndockedRect.Left < 0) UndockedRect.Left = 0;
}
if(UndockBottom > Screen->Height)
{
int Offset = UndockBottom - Screen->Height;
UndockedRect.Bottom -= Offset;
UndockedRect.Top -= Offset;
if(UndockedRect.Top < 0)
{
Offset = 0 - UndockedRect.Top;
UndockedRect.Top = 0;
UndockedRect.Bottom += Offset;
}
}

LCDPanel->ManualFloat(UndockedRect);
}

// Formularz główny
int top, left, height, width;

top = Registry->ReadInteger("Settings\\Position","MainFormTop",Top);
left = Registry->ReadInteger("Settings\\Position","MainFormLeft",Left); height = Registry->ReadInteger("Settings\\Size","MainFormHeight",Height); width = Registry->ReadInteger("Settings\\Size","MainFormWidth",Width);

if(width > Screen->Width) width = Screen->Width; // błąd !
if(left+width > Screen->Width)
{
left -= (left+width) - Screen->Width;
}
if(height > Screen->Height) height = Screen->Height; // błąd !
if(top+height > Screen->Height)
{
top -= (top+height) - Screen->Height;
}

Top = top;
Left = left;
Height = height;
Width = width;


// Pasek statusu
StatusBar1->Visible = Registry->ReadBool("Settings\\StatusBar",
"Visible",
StatusBar1->Visible);

//if(!StatusBar1->Visible) Height -= StatusBar1->Height;

EnableKeyboardInput = Registry->ReadBool("Settings",
"EnableKeyboard",
EnableKeyboardInput);

// Pasek kontrolny
std::list<TControlBandInfo> BandList;

for(int i=0; i<ButtonsControlBar->ControlCount; ++i)
{
AnsiString ControlPath = "Settings\\ControlBar\\";
ControlPath += ButtonsControlBar->Controls[i]->Name;

int ControlLeft = Registry->ReadInteger(ControlPath,
"Left",
ButtonsControlBar->Controls[i]->Left);
int ControlTop = Registry->ReadInteger(ControlPath,

"Top",

v