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

📄 guidm.pas

📁 DBDesigner 4 is a database design system that integrates database design, modelling, creation and ma
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit GUIDM;

//----------------------------------------------------------------------------------------------------------------------
//
// This file is part of fabFORCE DBDesigner4.
// Copyright (C) 2002, 2003 Michael G. Zinner, www.fabFORCE.net
//
// DBDesigner4 is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// DBDesigner4 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with DBDesigner4; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//----------------------------------------------------------------------------------------------------------------------
//
// Unit GUIDM.pas
// --------------
// Version 1.1, 31.03.2003, Mike
// Description
//   Contains help functions for the MainForm
//
// Changes:
//   Version 1.1, 31.03.2003, Mike
//     added RecentOpenSQLScriptFileDir, loading from, saving to ini-file
//   Version 1.0, 13.03.2003, Mike
//     initial version, Mike
//
//----------------------------------------------------------------------------------------------------------------------

interface

uses
  SysUtils, Classes, QTypes, IniFiles, QForms, QStyle, QMenus, QExtCtrls,
  Qt, QGraphics;

type
  TDMGUI = class(TDataModule)
    ApplActive: TTimer;

    procedure DataModuleCreate(Sender: TObject);
    procedure DataModuleDestroy(Sender: TObject);

    procedure LoadSettingsFromIniFile;
    procedure SaveSettingsToIniFile;

    function ApplRunFirstTime: Boolean;

    procedure AddFileToRecentFilesList(fname: string);
    function GetRecentFileCount: integer;
    function GetRecentFileName(id: integer): string;
    procedure OpenRecentFile(Sender: TObject);

    procedure SetQueryStatusLbl;
    procedure SetStatusCaption(s: string);

    function LoadTip: string;

    procedure CopyInitialSettingsToPrivatSettingsDir;

    procedure CheckIniFiles;
  private
    { Private declarations }
    RunFirstTime: Boolean;
    RecentFiles: TStringList;

    RecentFilesMICounter: integer; //used for naming RecentFileMenuItems
  public
    { Public declarations }
    RecentOpenFileDir,
    RecentSaveModelAsImageDir,
    RecentExportSQLCreatesDir,
    RecentOpenSQLScriptFileDir,
    RecentImportFileDir: string;

    DelaySplashScreen: integer;

    ReopenLastFile: Boolean;

    ShowPalettesDocked: Boolean;

    FormsOnTop: TList;

    ShowTipsOnStartup: Boolean;
    LastTipShown: integer;

    SQLTextFont: string;
    SQLTextFontSize: integer;

    MinimizeOnCtrlShiftC: Boolean;

    //Parameters for the Docked Query Editor
    DockedQueryPnlMode,
    DockedQueryPnlHeightM1,
    DockedQueryPnlHeightM2,
    DockedQueryPnlStoredSQLTreeWidthM1,
    DockedQueryPnlStoredSQLTreeWidthM2,
    DockedQueryPnlBLOBPnlWidthM1,
    DockedQueryPnlBLOBPnlWidthM2,
    DockedQueryPnlSQLPnlSizeM1,
    DockedQueryPnlSQLPnlSizeM2: integer;

    DockedQueryPnlStoredSQLTreeVisibleM1,
    DockedQueryPnlStoredSQLTreeVisibleM2,
    DockedQueryPnlBLOBPnlVisibleM1,
    DockedQueryPnlBLOBPnlVisibleM2: Boolean;

    UseSQLSyntaxHighlighting: Boolean;
    IgnoreSQLHistoryChange: Boolean;
  end;

const
  QEventType_SetApplStyle = QEventType(Integer(QEventType_ClxUser) + 100);
  QEventType_SetSQLTextFont = QEventType(Integer(QEventType_ClxUser) + 101);

var
  DMGUI: TDMGUI;

implementation

uses Main, MainDM, DBDM;

{$R *.xfm}


procedure TDMGUI.DataModuleCreate(Sender: TObject);
begin
  RunFirstTime:=False;

  RecentFiles:=TStringList.Create;
  FormsOnTop:=TList.Create;

  //Copy setting files or check version
  CheckIniFiles;

  RecentOpenFileDir:='';
  RecentExportSQLCreatesDir:='';
  RecentOpenSQLScriptFileDir:='';
  RecentImportFileDir:='';
  RecentFilesMICounter:=1;

  LoadSettingsFromIniFile;

  Application.HintHidePause:=10000;
end;

procedure TDMGUI.DataModuleDestroy(Sender: TObject);
begin
  SaveSettingsToIniFile;
  
  RecentFiles.Free;
  FormsOnTop.Free;
end;

function TDMGUI.ApplRunFirstTime: Boolean;
begin
  ApplRunFirstTime:=RunFirstTime;
end;

procedure TDMGUI.LoadSettingsFromIniFile;
var theIni: TMemIniFile;
  i, ApplStyle: Integer;
  theStringList: TStringList;
begin
  //Read IniFile
  theIni:=TMemIniFile.Create(DMMain.SettingsPath+DMMain.ProgName+'_Settings.ini');
  try
    //Check if the Program is opened the very first time
    if(theIni.ReadString('GeneralSettings', 'RunFirstTime', '0')='1')then
      RunFirstTime:=True;

    DelaySplashScreen:=StrToInt(theIni.ReadString('GeneralSettings', 'DelaySplashScreen',
      '1000'));

{$IFDEF LINUX}
    SQLTextFont:=theIni.ReadString('GeneralSettings', 'SQLTextFont', 'Helvetica');
{$ELSE}
    SQLTextFont:=theIni.ReadString('GeneralSettings', 'SQLTextFont', 'Verdana');
{$ENDIF}
    SQLTextFontSize:=StrToInt(theIni.ReadString('GeneralSettings', 'SQLTextFontSize', '8'));

    ReopenLastFile:=(StrToInt(theIni.ReadString('GeneralSettings', 'ReopenLastFile',
      '1'))=1);

    DMMain.NormalizeEditorForms:=(StrToInt(theIni.ReadString('GeneralSettings', 'EditorsFloatOnTop',
      '1'))=1);


    MinimizeOnCtrlShiftC:=(StrToInt(theIni.ReadString('GeneralSettings', 'MinimizeOnCtrlShiftC',
      '1'))=1);


    ApplStyle:=StrToInt(theIni.ReadString('GeneralSettings', 'ApplicationStyle', '4'));
    MainForm.SetApplStyle(ApplStyle);

    DMMain.HTMLBrowserAppl:=theIni.ReadString('GeneralSettings', 'HTMLBrowserAppl', '');


    DockedQueryPnlMode:=StrToInt(theIni.ReadString('DockedQueryPanel', 'Mode', '2'));
    DockedQueryPnlHeightM1:=StrToInt(theIni.ReadString('DockedQueryPanel', 'HeightM1', '226'));
    DockedQueryPnlHeightM2:=StrToInt(theIni.ReadString('DockedQueryPanel', 'HeightM2', '379'));
    DockedQueryPnlStoredSQLTreeVisibleM1:=(StrToInt(theIni.ReadString('DockedQueryPanel', 'StoredSQLTreeVisibleM1', '0'))=1);
    DockedQueryPnlStoredSQLTreeVisibleM2:=(StrToInt(theIni.ReadString('DockedQueryPanel', 'StoredSQLTreeVisibleM2', '1'))=1);
    DockedQueryPnlStoredSQLTreeWidthM1:=StrToInt(theIni.ReadString('DockedQueryPanel', 'StoredSQLTreeWidthM1', '159'));
    DockedQueryPnlStoredSQLTreeWidthM2:=StrToInt(theIni.ReadString('DockedQueryPanel', 'StoredSQLTreeWidthM2', '200'));
    DockedQueryPnlBLOBPnlVisibleM1:=(StrToInt(theIni.ReadString('DockedQueryPanel', 'BLOBPnlVisibleM1', '0'))=1);
    DockedQueryPnlBLOBPnlVisibleM2:=(StrToInt(theIni.ReadString('DockedQueryPanel', 'BLOBPnlVisibleM2', '0'))=1);
    DockedQueryPnlBLOBPnlWidthM1:=StrToInt(theIni.ReadString('DockedQueryPanel', 'BLOBPnlWidthM1', '180'));
    DockedQueryPnlBLOBPnlWidthM2:=StrToInt(theIni.ReadString('DockedQueryPanel', 'BLOBPnlWidthM2', '180'));
    DockedQueryPnlSQLPnlSizeM1:=StrToInt(theIni.ReadString('DockedQueryPanel', 'SQLPnlSizeM1', '426'));
    DockedQueryPnlSQLPnlSizeM2:=StrToInt(theIni.ReadString('DockedQueryPanel', 'SQLPnlSizeM2', '144'));

    UseSQLSyntaxHighlighting:=(StrToInt(theIni.ReadString('GeneralSettings', 'UseSQLSyntaxHighlighting', '0'))=1);

    IgnoreSQLHistoryChange:=(StrToInt(theIni.ReadString('GeneralSettings', 'IgnoreSQLHistoryChange', '1'))=1);

    //Do not Load recent data when run first
    if(Not(RunFirstTime))then
    begin
      ShowPalettesDocked:=(StrToInt(theIni.ReadString('GeneralSettings', 'ShowPalettesDocked',
        '1'))=1);

      ShowTipsOnStartup:=(StrToInt(theIni.ReadString('GeneralSettings', 'ShowTipsOnStartup', '1'))=1);
      try
        LastTipShown:=StrToInt(theIni.ReadString('GeneralSettings', 'LastTipShown', '0'));
      except
        LastTipShown:=-1;
      end;

      RecentOpenFileDir:=theIni.ReadString('RecentDirectories', 'RecentOpenFileDir', '');
      RecentSaveModelAsImageDir:=theIni.ReadString('RecentDirectories', 'RecentSaveModelAsImageDir', '');
      RecentOpenSQLScriptFileDir:=theIni.ReadString('RecentDirectories', 'RecentOpenSQLScriptFileDir', '');
      RecentImportFileDir:=theIni.ReadString('RecentDirectories', 'RecentImportFileDir', '');

      theStringList:=TStringList.Create;
      try
        //Read RecentFiles and add them to the Menu
        theIni.ReadSectionValues('RecentFiles', theStringList);
        for i:=theStringList.Count-1 downto 0 do
          AddFileToRecentFilesList(Copy(theStringList[i], Pos('=', theStringList[i])+1, Length(theStringList[i])));

      finally
        theStringList.Free;
      end;
    end
    else
    begin
      //Start with palettes docked when run first time
      ShowPalettesDocked:=True;

      ShowTipsOnStartup:=True;
      LastTipShown:=-1;
    end;

    if(RecentOpenFileDir='')then
      RecentOpenFileDir:=ExtractFilePath(Application.ExeName)+

⌨️ 快捷键说明

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