void __fastcall TGLForm2D::ZoomOutClick(TObject *Sender) { int factor; TForm* x = new TFormS(this,factor); x->Caption = "Introduce Factor"; x->ShowModal(); int pasos; TForm* y = new TFormS(this,pasos); y->Caption = "Introduce nº de pasos"; y->ShowModal(); GLdouble fIncr= (factor-1)/(GLdouble)pasos; GLdouble ancho = (xRight-xLeft); GLdouble alto =(yTop-yBot); for(int i=0;i<=pasos;i++){ GLdouble fAux= 1 + fIncr*i; GLdouble anchoNew= ancho*fAux; GLdouble altoNew= alto*fAux; glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(centroX-anchoNew/2.0, centroX+anchoNew/2.0, centroY-altoNew/2.0, centroY+altoNew/2.0); GLScene(); Sleep(50); } nuevoAncho = (xRight-xLeft)*factor; nuevoAlto = (yTop-yBot)*factor; yBot = centroY-(nuevoAlto/2.0); yTop = centroY+(nuevoAlto/2.0); xRight = centroX+(nuevoAncho/2.0); xLeft = centroX-(nuevoAncho/2.0); GLScene(); sc->set(xLeft,xRight,yTop,yBot); }
//--------------------------------------------------------------------------- void __fastcall TPictureViewer::FullViewBClick(TObject *Sender) { TForm* ImageFullView = new TForm(this); ImageFullView->Color = FBackGroundColor; TImage* FullImage = new TImage(ImageFullView); FullImage->Transparent = Image->Transparent; try { ImageFullView->BorderStyle = bsToolWindow; ImageFullView->FormStyle = fsStayOnTop; ImageFullView->Position = poScreenCenter; ImageFullView->Caption = GetString(sPicturePreview); FullImage->Left = 0; FullImage->Top = 0; FullImage->AutoSize = true; FullImage->Picture = Image->Picture; ImageFullView->ClientWidth = FullImage->Width; ImageFullView->ClientHeight = FullImage->Height; FullImage->Parent = ImageFullView; FullViewB->Enabled = false; ImageFullView->ShowModal(); FullViewB->Enabled = true; delete FullImage; FullImage = NULL; delete ImageFullView; ImageFullView = NULL; Image->Update(); } catch (Exception &e) { if (FullImage) delete FullImage; if (ImageFullView) delete ImageFullView; FullViewB->Enabled = true; } }
//--------------------------------------------------------------------------- void __fastcall TRouteSheet::AddButtonClick(TObject *Sender) //Добавление контрагента { //CounterpartyRouteSheet->Show(); TForm *myCounterpartyRouteSheet = new TCounterpartyRouteSheet(this); myCounterpartyRouteSheet->ShowModal(); delete myCounterpartyRouteSheet; }
void __fastcall TGLForm2D::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { GLdouble relacionAncho = (xRight-xLeft)/ClientWidth; GLdouble relacionAlto = (yTop-yBot)/ClientHeight; GLdouble cx = xLeft + (GLfloat)X*relacionAncho; GLdouble cy = yTop - (GLfloat)Y*relacionAlto; if(Button == mbLeft){ if(!seleccionar){ int tam; if(sc->getArbol()->empty()){ TForm* x = new TFormS(this,tam); x->Caption = "Introduce Tamaño"; x->ShowModal(); } sc->getArbol()->anidar(cx,cy,aleatorio,tam); } else if(!sc->getArbol()->empty()){ PVD2* p = new PVD2(cx,cy); if(sc->getArbol()->selCuadrado(p)) seleccionar = false; delete p; p = NULL; }else{ seleccionar = false; ShowMessage("No hay nada que seleccionar!"); } GLScene(); } else{ sc->getArbol()->desanidar(); GLScene(); } }
void __fastcall TFormClasificacion::ButtonListadoPartidosClick( TObject *Sender) { TForm *x = new TFormListadoPartidos(this,t); x->ShowModal(); delete x; MostrarClasificacion(); }
void __fastcall TFormClasificacion::ButtonBorrarEquipoClick( TObject *Sender) { TForm *x = new TFormBorrarEquipo(this,t); x->ShowModal(); delete x; MostrarClasificacion(); }
void __fastcall TFormClasificacion::ButtonAnyadirPartidoClick( TObject *Sender) { TForm *x = new TFormAnyadirPartido(this,t); x->ShowModal(); delete x; MostrarClasificacion(); }
//--------------------------------------------------------------------------- void __fastcall TFrm1010::ShowAppForms() { SfgForm *AppForm; TForm *form = new TForm(Application); TStringAlignGrid *grdAppForms = new TStringAlignGrid(form); form->ClientHeight = 154; form->ClientWidth = 402; form->BorderStyle = bsDialog; form->BorderIcons = TBorderIcons() << biSystemMenu; form->Caption = "Escolher Programa"; form->Position = poDesktopCenter; grdAppForms->Parent = form; grdAppForms->ColCount = 4; grdAppForms->DefaultRowHeight = 18; grdAppForms->AlignCol[1] = alCenter; grdAppForms->AlignCell[1][0] = alCenter; grdAppForms->AlignCell[2][0] = alCenter; grdAppForms->Cells[1][0] = "Programa"; grdAppForms->Cells[2][0] = "Título"; grdAppForms->Cells[3][0] = "Módulo"; grdAppForms->ColWidths[0] = 14; grdAppForms->ColWidths[1] = 74; grdAppForms->ColWidths[2] = 190; grdAppForms->ColWidths[3] = 100; grdAppForms->Align = alClient; grdAppForms->OnDblClick = &grdAppFormsDblClick; grdAppForms->Options = grdAppForms->Options << goColSizing << goRowSelect; grdAppForms->RowCount = 2; for (int i=0; i<AppForms->Count;i++) { AppForm = (SfgForm*)AppForms->Items[i]; if (i > 0) grdAppForms->RowCount++; grdAppForms->Cells[1][i+1] = AppForm->FormClass; grdAppForms->Cells[2][i+1] = AppForm->FormTitle; switch(AppForm->FormModule) { case APP_MODULO_ESTOQUE: grdAppForms->Cells[3][i+1] = "Estoque"; break; case APP_MODULO_COMPRAS: grdAppForms->Cells[3][i+1] = "Compras"; break; case APP_MODULO_VENDAS: grdAppForms->Cells[3][i+1] = "Vendas"; break; case APP_MODULO_FINANCAS: grdAppForms->Cells[3][i+1] = "Finanças"; break; default: grdAppForms->Cells[3][i+1] = "Padrão"; } } grdAppForms->SortColumn(1,true); grdAppForms->Row = 1; form->ShowModal(); delete form; }
//--------------------------------------------------------------------------- //上書き確認メッセージダイアログの表示(復号スレッドオブジェクトから呼ばれる) //--------------------------------------------------------------------------- int __fastcall TForm1::ShowConfirmOverwriteMassageForm(String MsgText, String &Path) { //ボタンをカスタマイズするので上記関数と分けて作成 TButton *btn; TMsgDlgButtons MsgButtons = (TMsgDlgButtons() << mbYesToAll << mbYes << mbNo << mbCancel); TForm *dlg = CreateMessageDialog(MsgText, mtConfirmation, MsgButtons, mbCancel); //ボタン名をそれぞれ書き換える btn = (TButton *)dlg->FindComponent("YesToAll"); //'全て上書き(&W)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_YES_TO_ALL); btn = (TButton *)dlg->FindComponent("Yes"); //'上書き(&O)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_YES); btn = (TButton *)dlg->FindComponent("No"); //'別名保存(&A)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_NO); btn = (TButton *)dlg->FindComponent("Cancel"); //'キャンセル(&C)' btn->Caption = LoadResourceString(&Msgexeout::_DIALOG_BUTTON_NAME_OVERWITE_CANCEL); dlg->Caption = LoadResourceString(&Msgexeout::_MSG_CAPTION_CONFIRMATION); dlg->ParentWindow = Form1->Handle; //メッセージダイアログの表示 int ret = dlg->ShowModal(); if (ret == mrNo) { //別名で保存する(いいえ) TSaveDialog *dlgsave = new TSaveDialog(dlg); //'復号ファイルの保存' dlgsave->Title = LoadResourceString(&Msgexeout::_DIALOG_SAVE_AS_FILE_CAPTION); dlgsave->InitialDir = ExtractFileDir(ExcludeTrailingPathDelimiter(Path)); dlgsave->FileName = ExtractFileName(ExcludeTrailingPathDelimiter(Path)); //'ファイルフォルダー|*' dlgsave->Filter = LoadResourceString(&Msgexeout::_DIALOG_SAVE_AS_FILTER); //別名保存ダイアログ if ( dlgsave->Execute() == true ){ Path = dlgsave->FileName; } else{ //キャンセル ret = mrCancel; } delete dlgsave; } delete dlg; return(ret); }
//--------------------------------------------------------------------------- //メッセージダイアログの表示(スレッドオブジェクトから呼ばれる) //--------------------------------------------------------------------------- int __fastcall TForm1::ShowConfirmMassageForm (String MsgText, TMsgDlgType MsgType, TMsgDlgButtons MsgButtons, TMsgDlgBtn MsgDefaultButton) { TForm *dlg = CreateMessageDialog(MsgText, MsgType, MsgButtons, MsgDefaultButton); dlg->ParentWindow = Form1->Handle; if ( MsgType == mtError) { dlg->Caption = LoadResourceString(&Msgexeout::_MSG_CAPTION_ERROR); } else { dlg->Caption = LoadResourceString(&Msgexeout::_MSG_CAPTION_CONFIRMATION); } //メッセージダイアログの表示 int ret = dlg->ShowModal(); delete dlg; return(ret); }
void ShowAbout(int iFontSize, Byte bLineBreak, Byte bVersionPos, String sDate, TPicture *pPicture, String sAddComp, String sVersion, String sAppName, String sCopyright, String sText, HICON hIcon) { TForm *Form; int I; String sCaption; TVSFixedFileInfo FileVersionInfo; String CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, OriginalFilename, ProductName, ProductVersion; TAboutObject *AboutObject; ShowWaitCursor(); // Randomize; if (IsShift() & IsCtrl()) { sAppName = "Дураев"; sAppName += sLineBreak; sAppName += "Константин Петрович"; sCopyright = ""; sCaption = "Автор"; sDate = "29.03.1981"; sVersion = ""; iFontSize = 16; sAddComp = NULL; pPicture = NULL; sText = ""; for (int i = 1; i < 280; i++) if (i % 40 == 0) sText = sText + sLineBreak; else // TODO: sText = sText + String(AnsiChar(Chr(Ord('А') + // Random(Ord('Я') - Ord('А'))))); sText = sText + L"Я"; } else { GetFileVerInfo(Application->ExeName, FileVersionInfo, CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, OriginalFilename, ProductName, ProductVersion); sCaption = LoadStr(IDS_ABOUT_CAPTION); if (sDate == NULL) sDate = FormatDateTime("yyyy.mm.dd", UnixToDateTime(((PIMAGE_NT_HEADERS)((DWORD)((PIMAGE_DOS_HEADER) HInstance) + (((PIMAGE_DOS_HEADER) HInstance)->e_lfanew))) ->FileHeader.TimeDateStamp)); if (sVersion == NULL) { sVersion = FileVersion; if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_DEBUG)) sVersion = sVersion + LoadStr(IDS_ABOUT_DEBUG); else if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_PRERELEASE)) sVersion = sVersion + LoadStr(IDS_ABOUT_RC); } if (sAppName == NULL) sAppName = ProductName; if (sCopyright == NULL) sCopyright = LegalCopyright + "|@[email protected]"; if (sText == NULL) { sText = LoadStr(IDS_ABOUT_EULA1) + sLineBreak + LoadStr(IDS_ABOUT_EULA2) + sLineBreak + LoadStr(IDS_ABOUT_EULA3) + sLineBreak + LoadStr(IDS_ABOUT_EULA4); } if (bLineBreak != MAXBYTE) { I = PosPlace(SPACE, sAppName, bLineBreak); sAppName = sAppName.SubString(1, I - 1) + sLineBreak + sAppName.SubString(I + 1, MAXINT); } } // IsShift and IsCtrl if (hIcon == NULL) hIcon = LoadIcon(HInstance, L"MAINICON"); AboutObject = new TAboutObject(); Form = new TForm(Application); // Owner; Form->ShowHint = true; Form->Font->Name = "Arial"; Form->Font->Size = 10; Form->BorderStyle = bsDialog; Form->Caption = sCaption; Form->ClientHeight = 165; Form->ClientWidth = 420; TBevel *bvlIconFrame = new TBevel(Form); bvlIconFrame->Parent = Form; bvlIconFrame->SetBounds(8, 14, 52, 52); bvlIconFrame->Shape = bsFrame; TPanel *pnlIcon = new TPanel(Form); pnlIcon->Parent = Form; pnlIcon->SetBounds(16, 22, 36, 36); pnlIcon->Caption = ""; pnlIcon->BevelOuter = bvNone; pnlIcon->BorderStyle = bsSingle; pnlIcon->ParentBackground = false; pnlIcon->Color = (TColor) Random(0xFFFFFF); TImage *imgIcon = new TImage(Form); // Icon imgIcon->Parent = pnlIcon; imgIcon->Align = alClient; imgIcon->Transparent = true; imgIcon->Picture->Icon->Handle = hIcon; TLabel *lblCopyright = new TLabel(Form); // Copyright lblCopyright->Tag = 1; lblCopyright->Parent = Form; lblCopyright->Font->Style = TFontStyles() << fsBold; lblCopyright->SetBounds(8, 80, 0, 0); int PosHint = Pos('|', sCopyright); if (PosHint == 0) lblCopyright->Caption = sCopyright; else { lblCopyright->Caption = sCopyright.SubString(1, PosHint - 1); lblCopyright->Hint = sCopyright.SubString(PosHint + 1, MAXINT); lblCopyright->Cursor = crHandPoint; lblCopyright->OnMouseEnter = AboutObject->MouseEnter; lblCopyright->OnMouseLeave = AboutObject->MouseLeave; if (lblCopyright->Hint[1] == '@') { lblCopyright->Hint = lblCopyright->Hint.SubString(2, MAXINT); AboutObject->MailAddress = lblCopyright->Hint; AboutObject->MailSubject = OriginalFilename + " " + FileVersion; } lblCopyright->OnClick = AboutObject->Click; } TLabel *lblText = new TLabel(Form); // Text lblText->Parent = Form; lblText->WordWrap = true; lblText->SetBounds(8, 100, Form->ClientWidth - 16, 0); lblText->Caption = sText; // I = lblText->Top + lblText->Height; Form->ClientHeight = Form->ClientHeight + lblText->Height; if (sAddComp != NULL) { /* with TBevel.Create(Form) do { Parent = Form; SetBounds(7, I + 5, Form.ClientWidth - 15, 5); Shape = bsTopLine; I = Top + Height; }; with TLabel.Create(Form) do // Add Components { Parent = Form; SetBounds(8, I, 0, 0); Caption = 'Программное обеспечение использует следующие компоненты:'; I = Top + Height; }; with TLabel.Create(Form) do // Components { Tag = 2; Parent = Form; Font.Style = [fsBold]; SetBounds(8, I, 0, 0); Caption = sAddComp; Form.ClientHeight = Form.ClientHeight + Height + 12; if FileExists(FileInAppDir(rsLicenses)) then { Cursor = crHandPoint; OnClick = ClickObject.Click; OnMouseEnter = ClickObject.MouseEnter; OnMouseLeave = ClickObject.MouseLeave; }; } */ } else // sAddComp != NULL Form->ClientHeight = Form->ClientHeight - 12; TBevel *bvlBottom = new TBevel(Form); bvlBottom->Parent = Form; bvlBottom->SetBounds(7, Form->ClientHeight - 43, Form->ClientWidth - 15, 5); bvlBottom->Shape = bsTopLine; lblMemory = new TLabel(Form); // Физическая ... lblMemory->Parent = Form; lblMemory->SetBounds(8, Form->ClientHeight - 38, 0, 0); lblMemory->Caption = LoadStr(IDS_ABOUT_MEMORY); lblMemoryValue = new TLabel(Form); // TotalPhys lblMemoryValue->Parent = Form; lblMemoryValue->Font->Style = TFontStyles() << fsBold; lblMemoryValue->SetBounds(lblMemory->Width + 13, Form->ClientHeight - 38, 0, 0); lblProc = new TLabel(Form); // Процессор: lblProc->Parent = Form; lblProc->SetBounds(8, Form->ClientHeight - 22, 0, 0); lblProc->Caption = LoadStr(IDS_ABOUT_PROCESSOR); lblProcValue = new TLabel(Form); // CPUSpeed lblProcValue->Parent = Form; lblProcValue->Font->Style = TFontStyles() << fsBold; lblProcValue->SetBounds(lblMemory->Width + 13, Form->ClientHeight - 22, 0, 0); TGradientPanel *pnlName = new TGradientPanel(Form); pnlName->Parent = Form; pnlName->StartUpdate(); pnlName->SetBounds(68, 8, Form->ClientWidth - 76, 64); pnlName->BorderStyle = bsSingle; pnlName->BevelOuter = bvNone; pnlName->ParentBackground = false; if (pPicture == NULL) pnlName->ColorStart = pnlIcon->Color; else pnlName->ColorStart = clBlack; pnlName->ColorEnd = clBlack; pnlName->EndUpdate(); if (pPicture == NULL) { TLabel *lblAppName = new TLabel(Form); // Application Name (1) lblAppName->Parent = pnlName; lblAppName->SetBounds(2, 2, Form->ClientWidth - 83, 58); lblAppName->Alignment = taCenter; lblAppName->AutoSize = false; lblAppName->Caption = sAppName; lblAppName->ParentColor = false; lblAppName->Color = clBlack; lblAppName->ParentFont = false; lblAppName->Font->Charset = DEFAULT_CHARSET; lblAppName->Font->Color = clBlack; lblAppName->Font->Height = -51; lblAppName->Font->Name = "Courier New"; lblAppName->Font->Style = TFontStyles() << fsBold << fsItalic; lblAppName->Font->Size = iFontSize; lblAppName->Transparent = true; lblAppName->Layout = tlCenter; lblAppName->WordWrap = true; TLabel *lblAppName2 = new TLabel(Form); // Application Name (2) lblAppName2->Parent = pnlName; lblAppName2->SetBounds(0, 0, Form->ClientWidth - 83, 58); lblAppName2->Alignment = taCenter; lblAppName2->AutoSize = false; lblAppName2->Caption = sAppName; lblAppName2->ParentColor = false; lblAppName2->Color = clBlack; lblAppName2->ParentFont = false; lblAppName2->Font->Charset = DEFAULT_CHARSET; lblAppName2->Font->Color = clWhite; lblAppName2->Font->Height = -51; lblAppName2->Font->Name = "Courier New"; lblAppName2->Font->Style = TFontStyles() << fsBold << fsItalic; lblAppName2->Font->Size = iFontSize; lblAppName2->Transparent = true; lblAppName2->Layout = tlCenter; lblAppName2->WordWrap = true; } // pPicture == NULL else { TImage *imgPicture = new TImage(Form); imgPicture->Parent = pnlName; imgPicture->Align = alClient; imgPicture->Picture->Assign(pPicture); } TLabel *lblDate = new TLabel(Form); // Date lblDate->Parent = pnlName; lblDate->Caption = sDate; lblDate->Font->Assign(Form->Font); lblDate->Font->Style = TFontStyles() << fsBold; lblDate->Font->Color = clWhite; lblDate->Font->Size = 8; lblDate->Alignment = taRightJustify; switch (3) { case 0: lblDate->SetBounds(2, 2, lblDate->Width, lblDate->Height); break; case 1: lblDate->SetBounds(2, pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width, lblDate->Height); break; case 2: lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, 2, lblDate->Width, lblDate->Height); break; default: lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width, lblDate->Height); } lblDate->Transparent = true; TLabel *lblVerion = new TLabel(Form); // Version lblVerion->Parent = pnlName; lblVerion->Caption = sVersion; lblVerion->Font->Assign(Form->Font); lblVerion->Font->Style = TFontStyles() << fsBold; lblVerion->Font->Color = clWhite; lblVerion->Font->Size = 8; switch (2) { case 0: lblVerion->SetBounds(2, 2, lblVerion->Width, lblVerion->Height); break; case 1: lblVerion->SetBounds(2, pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width, lblVerion->Height); break; case 2: lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, 2, lblVerion->Width, lblVerion->Height); break; default: lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width, lblVerion->Height); } lblVerion->Transparent = true; TButton *btnClose = new TButton(Form); btnClose->Parent = Form; btnClose->Caption = "OK"; btnClose->ModalResult = mrCancel; btnClose->Cancel = true; btnClose->SetBounds(Form->ClientWidth - 83, Form->ClientHeight - 34, 75, 26); btnClose->TabOrder = 0; TTimer *timer = new TTimer(Form); timer->OnTimer = AboutObject->TimerTimer; timer->Interval = 1; timer->Enabled = true; RestoreCursor(); Form->Left = (Screen->Width - Form->Width) / 2; Form->Top = (Screen->Height - Form->Height) / 2; SetCurPosToCenter(btnClose); Form->ShowModal(); Form->Free(); AboutObject->Free(); lblMemory = NULL; lblProc = NULL; lblMemoryValue = NULL; lblProcValue = NULL; }
//--------------------------------------------------------------------------- bool __fastcall InputDialog(const UnicodeString ACaption, const UnicodeString APrompt, UnicodeString & Value, UnicodeString HelpKeyword, TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize) { bool Result = False; TInputDialogToken Token; TForm * Form = new TForm(GetFormOwner(), 0); // bypass the VCL streaming (for Salamander) try { // salam needs to override this in UseSystemSettings Form->Position = poOwnerFormCenter; SetCorrectFormParent(Form); UseSystemSettingsPre(Form); // this is what TCustomForm.Loaded does // Note that this is not needed as due to use of an alternative constructor above // we are already set to default font // See TMessageForm::Create for contrary Form->Font->Assign(Application->DefaultFont); Form->ParentFont = true; Token.OnInitialize = OnInitialize; Token.PathInput = PathInput; TNotifyEvent OnShow; ((TMethod *)&OnShow)->Data = &Token; ((TMethod *)&OnShow)->Code = InputDialogShow; Form->OnShow = OnShow; Form->Canvas->Font = Form->Font; Form->BorderStyle = bsDialog; Form->Caption = ACaption; Form->ClientWidth = ScaleByTextHeightRunTime(Form, 275); Form->ClientHeight = ScaleByTextHeightRunTime(Form, 102); if (!HelpKeyword.IsEmpty()) { Form->HelpKeyword = HelpKeyword; Form->BorderIcons = TBorderIcons(Form->BorderIcons) << biHelp; } TLabel * Prompt = new TLabel(Form); Prompt->Parent = Form; Prompt->AutoSize = True; Prompt->Left = ScaleByTextHeightRunTime(Form, 10); Prompt->Top = ScaleByTextHeightRunTime(Form, 13); Prompt->Caption = APrompt; TEdit * Edit; THistoryComboBox * HistoryCombo; if (History == NULL) { Edit = new TEdit(Form); Edit->Parent = Form; Edit->Text = Value; Edit->SelectAll(); Edit->MaxLength = 255; Token.Data.Edit = Edit; Token.EditControl = Edit; } else { HistoryCombo = new THistoryComboBox(Form); HistoryCombo->Parent = Form; HistoryCombo->Text = Value; HistoryCombo->SelectAll(); HistoryCombo->Items = History; HistoryCombo->MaxLength = 255; HistoryCombo->AutoComplete = false; Token.EditControl = HistoryCombo; } Token.EditControl->Left = Prompt->Left; Token.EditControl->Top = ScaleByTextHeightRunTime(Form, 30); Token.EditControl->Width = ScaleByTextHeightRunTime(Form, 255); Prompt->FocusControl = Token.EditControl; int ButtonTop = ScaleByTextHeightRunTime(Form, 66); int ButtonSpace = ScaleByTextHeightRunTime(Form, 6); TButton * Button; Button = new TButton(Form); Button->Parent = Form; Button->Caption = Vcl_Consts_SMsgDlgOK; Button->ModalResult = mrOk; Button->Default = True; int ButtonHeight = ScaleByTextHeightRunTime(Button, Button->Height); int ButtonWidth = ScaleByTextHeightRunTime(Button, Button->Width); int ButtonsStart; if (HelpKeyword.IsEmpty()) { ButtonsStart = (Form->ClientWidth / 2) - ButtonWidth - (ButtonSpace / 2); } else { ButtonsStart = (Form->ClientWidth / 2) - (3 * ButtonWidth / 2) - ButtonSpace; } Button->SetBounds(ButtonsStart, ButtonTop, ButtonWidth, ButtonHeight); Button = new TButton(Form); Button->Parent = Form; Button->Caption = Vcl_Consts_SMsgDlgCancel; Button->ModalResult = mrCancel; Button->Cancel = True; Button->SetBounds(ButtonsStart + ButtonWidth + ButtonSpace, ButtonTop, ButtonWidth, ButtonHeight); if (!HelpKeyword.IsEmpty()) { Button = new TButton(Form); Button->Parent = Form; Button->Caption = Vcl_Consts_SMsgDlgHelp; Button->ModalResult = mrNone; Button->SetBounds(ButtonsStart + 2 * (ButtonWidth + ButtonSpace), ButtonTop, ButtonWidth, ButtonHeight); TNotifyEvent OnClick; ((TMethod*)&OnClick)->Code = InputDialogHelp; Button->OnClick = OnClick; } UseSystemSettingsPost(Form); if (Form->ShowModal() == DefaultResult(Form)) { if (History != NULL) { HistoryCombo->SaveToHistory(); History->Assign(HistoryCombo->Items); Value = HistoryCombo->Text; } else { Value = Edit->Text; } Result = true; } } __finally { delete Form; } return Result; }
void __fastcall TGLForm2D::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { switch(Key){ case(TECLA_E): cols = 0; while(!embaldosa && cols <= 0){ TForm* x = new TFormS(this,cols); x->Caption = "Introduce Columnas"; x->ShowModal(); } embaldosa = !embaldosa; if(!embaldosa) glViewport(0,0,ClientWidth,ClientHeight); break; case(KEY_LEFT): xLeft += 5; xRight += 5; centroX += 5; sc->set(xLeft,xRight,yTop,yBot); break; case(KEY_RIGHT): xLeft -= 5; xRight -= 5; centroX -= 5; sc->set(xLeft,xRight,yTop,yBot); break; case(KEY_UP): yTop -= 5; yBot -= 5; centroY -= 5; sc->set(xLeft,xRight,yTop,yBot); break; case(KEY_DOWN): yTop += 5; yBot += 5; centroY += 5; sc->set(xLeft,xRight,yTop,yBot); break; case(ZOOM_IN): nuevoAncho = (xRight-xLeft)/1.1; nuevoAlto = (yTop-yBot)/1.1; yBot = centroY-(nuevoAlto/2.0); yTop = centroY+(nuevoAlto/2.0); xRight = centroX+(nuevoAncho/2.0); xLeft = centroX-(nuevoAncho/2.0); sc->set(xLeft,xRight,yTop,yBot); break; case(ZOOM_OUT): nuevoAncho = (xRight-xLeft)*1.1; nuevoAlto = (yTop-yBot)*1.1; yBot = centroY-(nuevoAlto/2.0); yTop = centroY+(nuevoAlto/2.0); xRight = centroX+(nuevoAncho/2.0); xLeft = centroX-(nuevoAncho/2.0); sc->set(xLeft,xRight,yTop,yBot); break; } glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(xLeft,xRight, yBot,yTop); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); GLScene(); }
AboutBox& AboutBox::Display() const { VersionInfo info = mVersionInfo; string versionNumber = info[ "Version" ]; info.erase( "Version" ); string versionDetails; for( VersionInfo::reverse_iterator i = info.rbegin(); i != info.rend(); ++i ) versionDetails += ", " + i->first + ": " + i->second; versionDetails.erase( 0, 2 ); #ifdef __BORLANDC__ TForm* pForm = new TForm( static_cast<TComponent*>( NULL ) ); pForm->BorderStyle = bsDialog; pForm->Position = poScreenCenter; pForm->Caption = ( string( "About " ) + mApplicationName + "..." ).c_str(); TPanel* pPanel = new TPanel( pForm ); pPanel->Parent = pForm; pPanel->BorderStyle = bsNone; pPanel->BorderWidth = 0; pPanel->BevelOuter = bvLowered; pPanel->BevelInner = bvNone; pPanel->Color = clWhite; pPanel->Left = 10; pPanel->Top = 10; pPanel->Width = pForm->ClientWidth - 2 * pPanel->Left; Graphics::TBitmap* pBitmap = new Graphics::TBitmap; int logoWidth = GraphicResource::Width( Resources::BCI2000logo_mini ), logoHeight = GraphicResource::Width( Resources::BCI2000logo_mini ); pBitmap->Width = logoWidth + 1; pBitmap->Height = logoHeight + 1; pBitmap->Canvas->Brush->Color = pPanel->Color; pBitmap->Canvas->FillRect( TRect( 0, 0, pBitmap->Width, pBitmap->Height ) ); DrawContext dc = { pBitmap->Canvas->Handle, { 0, 0, logoWidth, logoHeight } }; GraphicResource::Render<RenderingMode::Transparent>( Resources::BCI2000logo_mini, dc ); TPicture* pPicture = new TPicture; pPicture->Graphic = pBitmap; TImage* pImage = new TImage( pForm ); pImage->Parent = pPanel; pImage->Left = pPanel->Left; pImage->Top = pPanel->Top; pImage->Width = pBitmap->Width; pImage->Height = pBitmap->Height; pImage->Picture = pPicture; TLabel* pNameLabel = new TLabel( pForm ); pNameLabel->Parent = pPanel; pNameLabel->Top = pImage->Top; pNameLabel->Left = 3 * pImage->Left + pImage->Width; pNameLabel->Font->Size *= 2; pNameLabel->Font->Style = pNameLabel->Font->Style << fsBold; pNameLabel->Caption = mApplicationName.c_str(); TLabel* pCopyrightLabel = new TLabel( pForm ); pCopyrightLabel->Parent = pPanel; pCopyrightLabel->Alignment = taLeftJustify; pCopyrightLabel->Caption = ( versionNumber + "\n\n" + BCI2000_COPYRIGHT ).c_str(); pCopyrightLabel->Top = pNameLabel->Top + pNameLabel->Height; pCopyrightLabel->Left = pNameLabel->Left; int textWidth = max( pCopyrightLabel->Width, pNameLabel->Width ); pPanel->ClientWidth = 4 * pImage->Left + pImage->Width + textWidth; pPanel->ClientHeight = pImage->Height + 2 * pImage->Top; pForm->ClientWidth = 2 * pPanel->Left + pPanel->Width; TLabel* pVersionLabel = new TLabel( pForm ); pVersionLabel->Parent = pForm; pVersionLabel->Alignment = taCenter; pVersionLabel->Top = 2 * pPanel->Top + pPanel->Height; pVersionLabel->WordWrap = true; pVersionLabel->Left = pPanel->Left; pVersionLabel->Width = pPanel->Width; pVersionLabel->Caption = versionDetails.c_str(); pVersionLabel->Left = ( pForm->ClientWidth - pVersionLabel->Width ) / 2; TButton* pButton = new TButton( pForm ); pButton->Parent = pForm; pButton->ModalResult = mrOk; pButton->Caption = "Close"; pButton->Left = ( pForm->ClientWidth - pButton->Width ) / 2; pButton->Top = pVersionLabel->Top + pVersionLabel->Height + pButton->Height / 2; pForm->ClientHeight = pButton->Top + ( 3 * pButton->Height ) / 2; pForm->ShowModal(); delete pForm; #endif // __BORLANDC__ return *const_cast<AboutBox*>( this ); }