⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 options.pas

📁 功能强大的ER图建模工具的源代码。 可以代替ERWin了
💻 PAS
📖 第 1 页 / 共 2 页
字号:

  SyncDatatypesOfForeignKeysCBox.Checked:=DMEER.SyncDatatypesOfForeignKeys;

  OutputLinuxStyleLineBreaksCBox.Checked:=DMEER.OutputLinuxStyleLineBreaks;

  AddQuotesToDefValsCBox.Checked:=DMEER.AddQuotesToDefVals;
end;

procedure TOptionsForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if(Not(DiscardChanges))then
    ApplyChanges;

  LanguageList.Free;
end;

procedure TOptionsForm.DefDatabaseTypeCBoxChange(Sender: TObject);
begin
  if(DefDatabaseTypeCBox.ItemIndex<>0)then
    DefDatabaseTypeCBox.ItemIndex:=0;
end;

procedure TOptionsForm.TblHeaderLUChange(Sender: TObject);
var HeaderBGFile, HeaderBGRightFile: string;
begin
  if(TblHeaderLU.ItemIndex>-1)then
  begin
    HeaderBGFile:=ExtractFilePath(Application.ExeName)+PathDelim+'Gfx'+PathDelim+'Table'+PathDelim+'Header_'+TblHeaderLU.Items[TblHeaderLU.ItemIndex]+'.bmp';
    HeaderBGRightFile:=ExtractFilePath(Application.ExeName)+PathDelim+'Gfx'+PathDelim+'Table'+PathDelim+'HeaderRight_'+TblHeaderLU.Items[TblHeaderLU.ItemIndex]+'.bmp';

    if((FileExists(HeaderBGFile))and(FileExists(HeaderBGRightFile)))then
    begin
      TblHeaderBGPnl.Bitmap.LoadFromFile(HeaderBGFile);
      TblHeaderBGPnl.Invalidate;
      TblHeaderBGImg.Picture.LoadFromFile(HeaderBGRightFile);
    end;
  end;
end;

procedure TOptionsForm.GetPageHeaders;
var result: integer;
  SearchRec: TSearchRec;
  HeaderBGRightFile,
  HeaderName: string;
begin
  TblHeaderLU.Items.Clear;

  Result := FindFirst(ExtractFilePath(Application.ExeName)+PathDelim+'Gfx'+PathDelim+'Table'+PathDelim+'Header_*.bmp', 0, SearchRec);
  if(Result<>0)then
    Exit;

  try
    while Result = 0 do
    begin
      HeaderName:=Copy(SearchRec.Name, Length('Header_')+1, Length(SearchRec.Name)-Length('Header_')-4);
      HeaderBGRightFile:=ExtractFilePath(Application.ExeName)+PathDelim+'Gfx'+PathDelim+'Table'+PathDelim+'HeaderRight_'+HeaderName+'.bmp';

      if(Copy(HeaderName, Length(HeaderName)-6, 7)<>'_Linked')and
        (FileExists(HeaderBGRightFile))then
        TblHeaderLU.Items.Add(HeaderName);

      Result := FindNext(SearchRec);
    end;
  finally
    FindClose(SearchRec);
  end;
end;

procedure TOptionsForm.ResetPersonalSettingsBtnClick(Sender: TObject);
begin
  if(MessageDlg(DMMain.GetTranslatedMessage('This action will overwrite your personal settings.'+#13#10+
    'Are you shure?', 222), mtConfirmation, [mbYes, mbNo], 0)=mrYes)then
    DMGUI.CopyInitialSettingsToPrivatSettingsDir;
end;

procedure TOptionsForm.SubmitBtnClick(Sender: TObject);
begin
  Close;
end;

procedure TOptionsForm.AbortBtnClick(Sender: TObject);
begin
  DiscardChanges:=True;

  Close;
end;

procedure TOptionsForm.ApplyChanges;
var i, j: integer;
  theIni: TMemIniFile;
begin
  DMDB.DefaultDatabaseType:=DefDatabaseTypeCBox.Items[DefDatabaseTypeCBox.ItemIndex];

  if(RegionColorsMemo.Lines.Count>0)then
    DMEER.DefaultRegionColors:=RegionColorsMemo.Text;
    //DMEER.RegionColors.Assign(RegionColorsMemo.Lines);

  try
    DMGUI.DelaySplashScreen:=StrToInt(SplashScreenDelayEd.Text);
  except
  end;

  DMEER.LimitUndoActions:=LimitUndoCBox.Checked;
  try
    DMEER.UndoActionLimit:=StrToInt(UndoLimitEd.Text);
  except
  end;

  DMGUI.ReopenLastFile:=ReopenLastFileCBox.Checked;

  DMMain.NormalizeEditorForms:=EditorsFloatOnTopCBox.Checked;

  DMEER.TblHeaderBGImgs:=TblHeaderLU.Items[TblHeaderLU.ItemIndex];

  {if(DMMain.NormalizeEditorForms)then
    DMMain.ApplicationActiveTimer.Enabled:=True;}


  DMEER.UsePositionGrid:=UsePosGridCBox.Checked;
  try
    DMEER.PositionGrid.X:=StrToInt(GridXEd.Text);
    DMEER.PositionGrid.Y:=StrToInt(GridYEd.Text);
  except
    DMEER.PositionGrid.X:=20;
    DMEER.PositionGrid.Y:=20;
  end;

  DMEER.TableNameInRefs:=TableNameInRefsCBox.Checked;
  DMEER.DefaultTableType:=DefaultTableTypeCBox.ItemIndex;
  DMEER.ActivateRefDefForNewRelations:=ActivateRefDefForNewRelationsCBox.Checked;

  DMEER.FKPrefix:=FKPrefixEd.Text;
  DMEER.FKPostfix:=FKPostfixEd.Text;

  DMGUI.ShowTipsOnStartup:=ShowTipsOnStartupCBox.Checked;

  DMEER.CreateFKRefDefIndex:=CreateFKRefDefIndexCBox.Checked;


  //MySQL_ReservedWords
  //Read IniFile
  theIni:=TMemIniFile.Create(DMMain.SettingsPath+'DBDesigner4_DatabaseInfo.ini');
  try
    theIni.EraseSection(DMDB.DefaultDatabaseType+'_ReservedWords');
    for i:=0 to ReservedWordsMemo.Lines.Count-1 do
      theIni.WriteString(DMDB.DefaultDatabaseType+'_ReservedWords', ReservedWordsMemo.Lines.Names[i],
        ReservedWordsMemo.Lines.ValueFromIndex[i]);
    theIni.UpdateFile;
  finally
    theIni.Free;
  end;

  if(FontCBox.ItemIndex>=0)then
  begin
    DMGUI.SQLTextFont:=FontCBox.Items[FontCBox.ItemIndex];
    DMGUI.SQLTextFontSize:=StrToInt(SQLFontSizeCBox.Items[SQLFontSizeCBox.ItemIndex]);
    sendCLXEvent(Application.MainForm.Handle, QCustomEvent_create(QEventType_SetSQLTextFont, self));
  end;

  DMGUI.MinimizeOnCtrlShiftC:=MinimizeOnCtrlShiftCCBox.Checked;

  DMEER.RenameReservedWords:=RenameReservedWordsCBox.Checked;
  DMEER.EncloseNames:=EncloseNamesCBox.Checked;

  DMMain.HTMLBrowserAppl:=HTMLBrowserEd.Text;

  if(DMGUI.UseSQLSyntaxHighlighting<>UseSQLSyntaxHighlightingCBox.Checked)then
  begin
    DMGUI.UseSQLSyntaxHighlighting:=UseSQLSyntaxHighlightingCBox.Checked;

{$IFDEF USE_SYNEDIT}
    for i:=0 to Screen.FormCount-1 do
      if(Screen.Forms[i] is TEditorQueryForm)then
        if(DMGUI.UseSQLSyntaxHighlighting)then
        begin
          TEditorQueryForm(Screen.Forms[i]).SQLSynEdit.Text:=
            TEditorQueryForm(Screen.Forms[i]).SQLMemo.Text;
          TEditorQueryForm(Screen.Forms[i]).SQLMemo.Visible:=False;
          TEditorQueryForm(Screen.Forms[i]).SQLSynEdit.Visible:=True;
        end
        else
        begin
          TEditorQueryForm(Screen.Forms[i]).SQLSynEdit.Visible:=False;
          TEditorQueryForm(Screen.Forms[i]).SQLMemo.Visible:=True;

          TEditorQueryForm(Screen.Forms[i]).SQLMemo.Lines.Clear;
          for j:=0 to TEditorQueryForm(Screen.Forms[i]).SQLSynEdit.Lines.Count-1 do
            TEditorQueryForm(Screen.Forms[i]).SQLMemo.Lines.Add(
              TEditorQueryForm(Screen.Forms[i]).SQLSynEdit.Lines[j]);
        end;
{$ENDIF}
  end;

  DMGUI.IgnoreSQLHistoryChange:=Not(IgnoreSQLHistoryChangeCBox.Checked);

  for i:=0 to TForm(Application.MainForm).MDIChildCount-1 do
  begin
    if(TForm(Application.MainForm).MDIChildren[i].Classname='TEERForm')then
    begin
      TEERForm(TForm(Application.MainForm).MDIChildren[i]).EERModel.RefreshTblImgs;
      TEERForm(TForm(Application.MainForm).MDIChildren[i]).EERModel.LoadReservedWordsFromIniFile;
    end;
  end;

  DMEER.DoNotUseRelNameInRefDef:=DonotuseRelNameCbox.Checked;

  DMEER.UseNewXMLParser:=ActivateNewXMLParserCBox.Checked;

  DMEER.SyncDatatypesOfForeignKeys:=SyncDatatypesOfForeignKeysCBox.Checked;

  DMEER.OutputLinuxStyleLineBreaks:=OutputLinuxStyleLineBreaksCBox.Checked;

  DMEER.AddQuotesToDefVals:=AddQuotesToDefValsCBox.Checked;
end;

procedure TOptionsForm.UsePosGridCBoxClick(Sender: TObject);
begin
  GridWidthLbl.Enabled:=UsePosGridCBox.Checked;
  GridXEd.Enabled:=UsePosGridCBox.Checked;
  GridWidthUnitsLbl.Enabled:=UsePosGridCBox.Checked;

  GridHeightLbl.Enabled:=UsePosGridCBox.Checked;
  GridYEd.Enabled:=UsePosGridCBox.Checked;
  GridHeightUnitsLbl.Enabled:=UsePosGridCBox.Checked;
end;

procedure TOptionsForm.SubmitBtnMouseEnter(Sender: TObject);
begin
  TSpeedButton(Sender).Enabled:=True;
end;

procedure TOptionsForm.SubmitBtnMouseLeave(Sender: TObject);
begin
  TSpeedButton(Sender).Enabled:=False;
end;

procedure TOptionsForm.PageControlChange(Sender: TObject);
begin
  EditOptionsTipPanel.Visible:=(PageControl.ActivePage=DefEditingOptionsSheet);
end;

procedure TOptionsForm.PageControlTreeViewChange(Sender: TObject;
  Node: TTreeNode);
begin
  PageControl.ActivePageIndex:=PageControlTreeView.Selected.AbsoluteIndex;
  PageControlTitleLbl.Caption:=PageControlTreeView.Selected.Text;
end;

procedure TOptionsForm.LanguageCBoxCloseUp(Sender: TObject);
begin
  DMMain.SetLanguageCode(LanguageList.ValueFromIndex[LanguageCBox.ItemIndex]);

  //Translate PageControlTreeView Items
  PageControlTreeView.Items[0].Text:=DMMain.GetTranslatedMessage('General Options', 251);
  PageControlTreeView.Items[1].Text:=DMMain.GetTranslatedMessage('Visual Options', 252);
  PageControlTreeView.Items[2].Text:=DMMain.GetTranslatedMessage('Database Options', 253);
  PageControlTreeView.Items[3].Text:=DMMain.GetTranslatedMessage('Default Model Options', 254);
end;

procedure TOptionsForm.HTMLBrowserCBoxClick(Sender: TObject);
begin
  HTMLBrowserEd.Enabled:=HTMLBrowserCBox.Checked;
  if(Not(HTMLBrowserCBox.Checked))then
    HTMLBrowserEd.Text:='';
end;

procedure TOptionsForm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if(Key=Key_Escape)then
    AbortBtnClick(self);
end;

procedure TOptionsForm.SelectFontBtnClick(Sender: TObject);
var theDlg: TFontDialog;
  i: integer;
begin
  theDlg:=TFontDialog.Create(self);
  try
    theDlg.Font:=Font;
    if(theDlg.Execute)then
    begin
      DMMain.ApplicationFontName:=theDlg.Font.Name;
      DMMain.ApplicationFontSize:=theDlg.Font.Size;
      DMMain.ApplicationFontStyle:=theDlg.Font.Style;

      Application.Font.Name:=DMMain.ApplicationFontName;
      Application.Font.Size:=DMMain.ApplicationFontSize;
      Application.Font.Style:=DMMain.ApplicationFontStyle;

      FontEdit.Text:=DMMain.ApplicationFontName+', '+
        IntToStr(DMMain.ApplicationFontSize);

      for i:=0 to Screen.FormCount-1 do
        DMMain.InitForm(Screen.Forms[i], False, False);
    end;
  finally
    theDlg.Free;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -