Browse Source

+ open dialog supports mask list

peter 26 years ago
parent
commit
afba976e1a
5 changed files with 483 additions and 441 deletions
  1. 50 33
      ide/text/fphelp.pas
  2. 37 18
      ide/text/fpini.pas
  3. 7 4
      ide/text/fpmfile.inc
  4. 5 1
      ide/text/fpvars.pas
  5. 384 385
      ide/text/fpviews.pas

+ 50 - 33
ide/text/fphelp.pas

@@ -34,9 +34,9 @@ type
     end;
 
 procedure Help(FileID, Context: word; Modal: boolean);
-procedure HelpIndex(Keyword: string);
+procedure HelpIndex(const Keyword: string);
 procedure HelpTopicSearch(Editor: PEditor);
-procedure HelpTopic(S: string);
+procedure HelpTopic(const S: string);
 
 procedure InitHelpSystem;
 procedure DoneHelpSystem;
@@ -44,8 +44,8 @@ procedure DoneHelpSystem;
 procedure InitHelpFiles;
 procedure DoneHelpFiles;
 
-procedure PushStatus(S: string);
-procedure SetStatus(S: string);
+procedure PushStatus(const S: string);
+procedure SetStatus(const S: string);
 procedure ClearStatus;
 procedure PopStatus;
 
@@ -200,20 +200,24 @@ begin
 end;
 
 procedure InitHelpSystem;
-procedure AddOAFile(HelpFile: string);
-begin
-  {$IFDEF DEBUG}SetStatus(strLoadingHelp+' ('+SmartPath(HelpFile)+')');{$ENDIF}
-  HelpFacility^.AddOAHelpFile(HelpFile);
-  {$IFDEF DEBUG}SetStatus(strLoadingHelp);{$ENDIF}
-end;
-procedure AddHTMLFile(TOCEntry,HelpFile: string);
-begin
-  {$IFDEF DEBUG}SetStatus(strLoadingHelp+' ('+SmartPath(HelpFile)+')');{$ENDIF}
-  HelpFacility^.AddHTMLHelpFile(HelpFile, TOCEntry);
-  {$IFDEF DEBUG}SetStatus(strLoadingHelp);{$ENDIF}
-end;
-var I: integer;
-    S: string;
+
+  procedure AddOAFile(HelpFile: string);
+  begin
+    {$IFDEF DEBUG}SetStatus(strLoadingHelp+' ('+SmartPath(HelpFile)+')');{$ENDIF}
+    HelpFacility^.AddOAHelpFile(HelpFile);
+    {$IFDEF DEBUG}SetStatus(strLoadingHelp);{$ENDIF}
+  end;
+
+  procedure AddHTMLFile(TOCEntry,HelpFile: string);
+  begin
+    {$IFDEF DEBUG}SetStatus(strLoadingHelp+' ('+SmartPath(HelpFile)+')');{$ENDIF}
+    HelpFacility^.AddHTMLHelpFile(HelpFile, TOCEntry);
+    {$IFDEF DEBUG}SetStatus(strLoadingHelp);{$ENDIF}
+  end;
+
+var
+  I: Sw_integer;
+  S: string;
 begin
   New(HelpFacility, Init);
   PushStatus(strLoadingHelp);
@@ -221,7 +225,7 @@ begin
   for I:=0 to HelpFiles^.Count-1 do
     begin
       S:=HelpFiles^.At(I)^;
-      if copy(UpcaseStr(ExtOf(S)),1,4)='.HTM' then
+      if (copy(UpcaseStr(ExtOf(S)),1,4)='.HTM') then
         AddHTMLFile(S,S)
       else
         AddOAFile(S);
@@ -238,7 +242,11 @@ end;
 
 procedure DoneHelpSystem;
 begin
-  if HelpFacility<>nil then Dispose(HelpFacility, Done); HelpFacility:=nil;
+  if assigned(HelpFacility) then
+   begin
+     Dispose(HelpFacility, Done);
+     HelpFacility:=nil;
+   end;
   HelpInited:=false;
 end;
 
@@ -282,20 +290,22 @@ begin
   HelpTopic(S);
 end;
 
-procedure HelpTopic(S: string);
-var FileID, Ctx: word;
-var Found: boolean;
+procedure HelpTopic(const S: string);
+var
+  FileID, Ctx: word;
+  Found: boolean;
 begin
   CheckHelpSystem;
   PushStatus(strLocatingTopic);
   Found:=HelpFacility^.TopicSearch(S,FileID,Ctx);
   PopStatus;
   if Found then
-     Help(FileID,Ctx,false) else
-     HelpIndex(S);
+    Help(FileID,Ctx,false)
+  else
+    HelpIndex(S);
 end;
 
-procedure HelpIndex(Keyword: string);
+procedure HelpIndex(const Keyword: string);
 begin
   HelpCreateWindow;
   with HelpWindow^ do
@@ -311,9 +321,10 @@ begin
   Message(Application,evCommand,cmUpdate,nil);
 end;
 
-procedure PushStatus(S: string);
+procedure PushStatus(const S: string);
 begin
-  if StatusLine=nil then Exit;
+  if StatusLine=nil then
+    Exit;
   If StatusStackPtr<=MaxStatusLevel then
     StatusStack[StatusStackPtr]:=PAdvancedStatusLine(StatusLine)^.GetStatusText
   else
@@ -324,7 +335,8 @@ end;
 
 procedure PopStatus;
 begin
-  if StatusLine=nil then Exit;
+  if StatusLine=nil then
+    Exit;
   Dec(StatusStackPtr);
   If StatusStackPtr<=MaxStatusLevel then
     SetStatus(StatusStack[StatusStackPtr])
@@ -332,9 +344,10 @@ begin
     SetStatus(StatusStack[MaxStatusLevel]);
 end;
 
-procedure SetStatus(S: string);
+procedure SetStatus(const S: string);
 begin
-  if StatusLine=nil then Exit;
+  if StatusLine=nil then
+    Exit;
   PAdvancedStatusLine(StatusLine)^.SetStatusText(S);
 end;
 
@@ -350,13 +363,17 @@ end;
 
 procedure DoneHelpFiles;
 begin
-  if HelpFiles<>nil then Dispose(HelpFiles, Done);
+  if assigned(HelpFiles) then
+    Dispose(HelpFiles, Done);
 end;
 
 END.
 {
   $Log$
-  Revision 1.8  1999-02-11 19:07:21  pierre
+  Revision 1.9  1999-02-19 18:43:45  peter
+    + open dialog supports mask list
+
+  Revision 1.8  1999/02/11 19:07:21  pierre
     * GDBWindow redesigned :
       normal editor apart from
       that any kbEnter will send the line (for begin to cursor)

+ 37 - 18
ide/text/fpini.pas

@@ -63,6 +63,7 @@ const
   ieHelpFiles        = 'Files';
   ieDefaultTabSize   = 'DefaultTabSize';
   ieDefaultEditorFlags='DefaultFlags';
+  ieOpenExts         = 'OpenExts';
   ieHighlightExts    = 'Exts';
   ieTabsPattern      = 'NeedsTabs';
   ieDoubleClickDelay = 'DoubleDelay';
@@ -206,14 +207,15 @@ var INIFile: PINIFile;
     S,PS,S1,S2,S3: string;
     I,P: integer;
     BreakPointCount:longint;
-    OK: boolean;
     ts : TSwitchMode;
     W: word;
 begin
-  OK:=ExistsFile(INIPath);
-  if OK then
- begin
+  ReadINIFile:=false;
+  if not ExistsFile(INIPath) then
+   exit;
   New(INIFile, Init(INIPath));
+{ Files }
+  OpenExts:=INIFile^.GetEntry(secFiles,ieOpenExts,OpenExts);
   RecentFileCount:=High(RecentFiles);
   for I:=Low(RecentFiles) to High(RecentFiles) do
     begin
@@ -229,18 +231,15 @@ begin
         LastPos.Y:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
       end;
     end;
+{ Run }
   SetRunParameters(INIFile^.GetEntry(secRun,ieRunParameters,GetRunParameters));
+{ Compile }
   PrimaryFile:=INIFile^.GetEntry(secCompile,iePrimaryFile,PrimaryFile);
- {   SwitchesModeStr : array[TSwitchMode] of string[8]=
-      ('NORMAL','DEBUG','RELEASE');}
   S:=INIFile^.GetEntry(secCompile,ieCompileMode,'');
   for ts:=low(TSwitchMode) to high(TSwitchMode) do
-    begin
-      if SwitchesModeStr[ts]=S then
-        begin
-          SwitchesMode:=ts;
-        end;
-    end;
+   if SwitchesModeStr[ts]=S then
+     SwitchesMode:=ts;
+{ Help }
   S:=INIFile^.GetEntry(secHelp,ieHelpFiles,'');
   repeat
     P:=Pos(';',S); if P=0 then P:=length(S)+1;
@@ -248,23 +247,28 @@ begin
     if PS<>'' then HelpFiles^.Insert(NewStr(PS));
     Delete(S,1,P);
   until S='';
+{ Editor }
 {$ifndef EDITORS}
   DefaultTabSize:=INIFile^.GetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   DefaultCodeEditorFlags:=INIFile^.GetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
 {$endif}
+{ Highlight }
   HighlightExts:=INIFile^.GetEntry(secHighlight,ieHighlightExts,HighlightExts);
   TabsPattern:=INIFile^.GetEntry(secHighlight,ieTabsPattern,TabsPattern);
+{ SourcePath }
   SourceDirs:=INIFile^.GetEntry(secSourcePath,ieSourceList,SourceDirs);
+{ Mouse }
   DoubleDelay:=INIFile^.GetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
   MouseReverse:=boolean(INIFile^.GetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse)));
   AltMouseAction:=INIFile^.GetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   CtrlMouseAction:=INIFile^.GetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
+{ Search }
   FindFlags:=INIFile^.GetIntEntry(secSearch,ieFindFlags,FindFlags);
-  { Breakpoints }
+{ Breakpoints }
   BreakpointCount:=INIFile^.GetIntEntry(secBreakpoint,ieBreakpointCount,0);
   for i:=1 to BreakpointCount do
     ReadOneBreakPointEntry(i-1,INIFile);
-
+{ Tools }
   for I:=1 to MaxToolCount do
     begin
       S:=IntToStr(I);
@@ -275,6 +279,7 @@ begin
       W:=Max(0,Min(65535,INIFile^.GetIntEntry(secTools,ieToolHotKey+S,0)));
       AddTool(S1,S2,S3,W);
     end;
+{ Colors }
   S:=AppPalette;
   PS:=StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_1_40',PaletteToStr(copy(S,1,40))));
   PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_41_80',PaletteToStr(copy(S,41,40))));
@@ -284,8 +289,7 @@ begin
   PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_201_240',PaletteToStr(copy(S,201,40))));
   AppPalette:=PS;
   Dispose(INIFile, Done);
- end;
-  ReadINIFile:=OK;
+  ReadINIFile:=true;
 end;
 
 function WriteINIFile: boolean;
@@ -303,6 +307,8 @@ begin
 end;
 begin
   New(INIFile, Init(INIPath));
+{ Files }
+  INIFile^.SetEntry(secFiles,ieOpenExts,'"'+OpenExts+'"');
   for I:=1 to High(RecentFiles) do
     begin
       if I<=RecentFileCount then
@@ -311,29 +317,38 @@ begin
          S:='';
       INIFile^.SetEntry(secFiles,ieRecentFile+IntToStr(I),S);
     end;
+{ Run }
   INIFile^.SetEntry(secRun,ieRunParameters,GetRunParameters);
+{ Compile }
   INIFile^.SetEntry(secCompile,iePrimaryFile,PrimaryFile);
   INIFile^.SetEntry(secCompile,ieCompileMode,SwitchesModeStr[SwitchesMode]);
+{ Help }
   S:='';
   HelpFiles^.ForEach(@ConcatName);
   INIFile^.SetEntry(secHelp,ieHelpFiles,'"'+S+'"');
+{ Editor }
 {$ifndef EDITORS}
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
 {$endif}
+{ Highlight }
   INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
   INIFile^.SetEntry(secHighlight,ieTabsPattern,'"'+TabsPattern+'"');
+{ SourcePath }
   INIFile^.SetEntry(secSourcePath,ieSourceList,'"'+SourceDirs+'"');
+{ Mouse }
   INIFile^.SetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
   INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
   INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
+{ Search }
   INIFile^.SetIntEntry(secSearch,ieFindFlags,FindFlags);
-  { Breakpoints }
+{ Breakpoints }
   BreakPointCount:=BreakpointCollection^.Count;
   INIFile^.SetIntEntry(secBreakpoint,ieBreakpointCount,BreakpointCount);
   for i:=1 to BreakpointCount do
     WriteOneBreakPointEntry(I-1,INIFile);
+{ Tools }
   INIFile^.DeleteSection(secTools);
   for I:=1 to GetToolCount do
     begin
@@ -347,6 +362,7 @@ begin
       INIFile^.SetEntry(secTools,ieToolParams+S,S3);
       INIFile^.SetIntEntry(secTools,ieToolHotKey+S,W);
     end;
+{ Colors }
   if AppPalette<>CIDEAppColor then
   begin
     { this has a bug. if a different palette has been read on startup, and
@@ -368,7 +384,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.11  1999-02-10 09:53:14  pierre
+  Revision 1.12  1999-02-19 18:43:46  peter
+    + open dialog supports mask list
+
+  Revision 1.11  1999/02/10 09:53:14  pierre
   * better storing of breakpoints
 
   Revision 1.10  1999/02/05 13:08:42  pierre

+ 7 - 4
ide/text/fpmfile.inc

@@ -80,12 +80,12 @@ begin
   OpenIt:=FileName<>'';
   if not OpenIt then
    begin
-     New(D, Init(OpenFileLastExt,'Open a file','File to open',fdOpenButton,0));
+     New(D, Init(OpenExts,'Open a file','File to open',fdOpenButton,0));
      OpenIt:=Desktop^.ExecView(D)<>cmCancel;
      if OpenIt then
        Begin
          D^.GetFileName(FileName);
-         OpenFileLastExt:=D^.WildCard;
+         OpenExts:=D^.WildCard;
        End;
      Dispose(D, Done);
    end;
@@ -122,7 +122,7 @@ begin
        if ConfirmBox(#3'Directory %s is not in list'#13#3+
             'Should we add it ?',@P,false)=cmYes then
           SourceDirs:=SourceDirs+';'+Dir;
-       
+
      OpenEditorWindow(nil,FileName,0,0);
    end;
   OpenSearch:=OpenIt;
@@ -156,7 +156,10 @@ end;
 
 {
   $Log$
-  Revision 1.8  1999-02-05 12:11:57  pierre
+  Revision 1.9  1999-02-19 18:43:47  peter
+    + open dialog supports mask list
+
+  Revision 1.8  1999/02/05 12:11:57  pierre
     + SourceDir that stores directories for sources that the
       compiler should not know about
       Automatically asked for addition when a new file that

+ 5 - 1
ide/text/fpvars.pas

@@ -31,6 +31,7 @@ type
 const ClipboardWindow  : PClipboardWindow = nil;
       CalcWindow       : PCalculator = nil;
       RecentFileCount  : integer = 0;
+      OpenExts         : string[80] = '*.pas;*.pp;*.inc';
       HighlightExts    : string[80] = '*.pas;*.pp;*.inc';
       TabsPattern      : string = 'make*;make*.*';
       SourceDirs       : string = '';
@@ -66,7 +67,10 @@ implementation
 END.
 {
   $Log$
-  Revision 1.8  1999-02-11 13:10:04  pierre
+  Revision 1.9  1999-02-19 18:43:48  peter
+    + open dialog supports mask list
+
+  Revision 1.8  1999/02/11 13:10:04  pierre
    + GDBWindow only with -dGDBWindow for now : still buggy !!
 
   Revision 1.7  1999/02/05 12:07:55  pierre

File diff suppressed because it is too large
+ 384 - 385
ide/text/fpviews.pas


Some files were not shown because too many files changed in this diff