File: JcfHelp.pas

package info (click to toggle)
lazarus 1.2.4%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 170,220 kB
  • ctags: 115,165
  • sloc: pascal: 1,386,898; xml: 257,878; sh: 2,935; java: 603; makefile: 549; perl: 297; sql: 174; ansic: 137
file content (130 lines) | stat: -rw-r--r-- 3,977 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
unit JcfHelp;

{(*}
(*------------------------------------------------------------------------------
 Delphi Code formatter source code 

The Original Code is JCFHelp, released May 2003.
The Initial Developer of the Original Code is Anthony Steele. 
Portions created by Anthony Steele are Copyright (C) 1999-2008 Anthony Steele.
All Rights Reserved. 
Contributor(s): Anthony Steele. 

The contents of this file are subject to the Mozilla Public License Version 1.1
(the "License"). you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.mozilla.org/NPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and limitations
under the License.

Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 or later (the "GPL") 
See http://www.gnu.org/licenses/gpl.html
------------------------------------------------------------------------------*)
{*)}

{$I JcfGlobal.inc}

interface

{ code interface to JCF help file }

function GetHelpFilePath: string;

const

  { help context ids }
  HELP_MAIN = 10;
  HELP_PROGRAMS = 12;
  HELP_SETTINGS_STORED = 15;
  HELP_SETTINGS_LOGGING = 24;
  HELP_SETTINGS_EXCLUSIONS = 26;

  HELP_BASIC_SETTINGS = 30;
  HELP_FORMAT_FILE = 40;

  HELP_OBFUSCATE_SETTINGS = 50;
  HELP_CLARIFY = 60;
  HELP_CLARIFY_SPACES = 70;
  HELP_CLARIFY_INDENTATION = 80;
  HELP_CLARIFY_LONG_LINES = 85;
  HELP_CLARIFY_RETURNS = 90;
  HELP_CLARIFY_BLANK_LINES = 95;
  HELP_CLARIFY_BLOCKS = 100;
  HELP_CLARIFY_ALIGN = 110;
  HELP_CLARIFY_COMMENTS = 80;

  HELP_CLARIFY_CAPITALISATION = 120;
  HELP_CLARIFY_FIND_AND_REPLACE = 130;
  HELP_CLARIFY_FIND_AND_REPLACE_USES = 140;
  HELP_COMMAND_LINE_PARAMS = 200;

  HELP_CLARIFY_TRANSFORM = 211;
  HELP_CLARIFY_WARNINGS = 212;

  HELP_ISSUES = 220;
  HELP_INFO = 1000;

  HELP_FILE_NAME = 'CodeFormat.chm';

implementation

uses
  {$ifndef fpc} Windows, {$endif} SysUtils, Forms;

function GetHelpFilePath: string;
var
  HelpFilePath: string;
begin
  HelpFilePath := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) +
    HELP_FILE_NAME;
{$ifndef fpc}
  if not FileExists(HelpFilePath) then
  begin
    HelpFilePath := IncludeTrailingPathDelimiter(
      ExtractFilePath(GetModuleName(GetModuleHandle('JCFIdeD12.bpl')))) +
      HELP_FILE_NAME;
    if not FileExists(HelpFilePath) then
    begin
      HelpFilePath := IncludeTrailingPathDelimiter(
        ExtractFilePath(GetModuleName(GetModuleHandle('JCFIdeD11.bpl')))) +
        HELP_FILE_NAME;
      if not FileExists(HelpFilePath) then
      begin
        HelpFilePath := IncludeTrailingPathDelimiter(
          ExtractFilePath(GetModuleName(GetModuleHandle('JCFIdeD10.bpl')))) +
          HELP_FILE_NAME;
        if not FileExists(HelpFilePath) then
        begin
          HelpFilePath := IncludeTrailingPathDelimiter(
            ExtractFilePath(GetModuleName(GetModuleHandle('JCFIdeD9.bpl')))) +
            HELP_FILE_NAME;
          if not FileExists(HelpFilePath) then
          begin
            HelpFilePath := IncludeTrailingPathDelimiter(
              ExtractFilePath(GetModuleName(GetModuleHandle('JCFIdeD7.bpl')))) +
              HELP_FILE_NAME;
            if not FileExists(HelpFilePath) then
            begin
              HelpFilePath := IncludeTrailingPathDelimiter(
                ExtractFilePath(GetModuleName(GetModuleHandle('JCFIdeD6.bpl')))) +
                HELP_FILE_NAME;
              if not FileExists(HelpFilePath) then
              begin
                HelpFilePath := IncludeTrailingPathDelimiter(
                  ExtractFilePath(GetModuleName(GetModuleHandle('JCFIdeD5.bpl')))) +
                  HELP_FILE_NAME;
              end;
            end;
          end;
        end;
      end;
    end;
  end;
{$endif}
  Result := HelpFilePath;
end;

end.