Menu

[f90d0d]: / Source / CompOptionsFrame.pas  Maximize  Restore  History

Download this file

140 lines (111 with data), 4.3 kB

  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
131
132
133
134
135
136
137
138
{
This file is part of Dev-C++
Copyright (c) 2004 Bloodshed Software
Dev-C++ 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.
Dev-C++ 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 Dev-C++; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit CompOptionsFrame;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, ValEdit, ComCtrls, ExtCtrls, CompOptionsList, project, utils, ProjectTypes, StdCtrls;
type
TCompOptionsFrame = class(TFrame)
tabs: TTabControl;
vle: TCompOptionsList;
procedure tabsChange(Sender: TObject);
procedure vleSetEditText(Sender: TObject; ACol, ARow: Integer; const Value: string);
public
fCurrentIndex: integer;
procedure FillOptions;
end;
implementation
uses
devcfg, multilangsupport;
{$R *.dfm}
{ TCompOptionsFrame }
procedure TCompOptionsFrame.FillOptions;
var
I: integer;
CompilerSet: TdevCompilerSet;
begin
if (fCurrentIndex >= devCompilerSets.Count) or (fCurrentIndex < 0) then
Exit;
CompilerSet := devCompilerSets[fCurrentIndex];
for I := 0 to CompilerSet.Options.Count - 1 do
if tabs.Tabs.IndexOf(Lang[PCompilerOption(CompilerSet.Options[I])^.Section]) = -1 then
tabs.Tabs.Add(Lang[PCompilerOption(CompilerSet.Options[I])^.Section]);
tabsChange(nil);
end;
procedure TCompOptionsFrame.tabsChange(Sender: TObject);
var
I, J, idx: integer;
currenttab: AnsiString;
option: TCompilerOption;
CompilerSet: TdevCompilerSet;
begin
if (fCurrentIndex >= devCompilerSets.Count) or (fCurrentIndex < 0) then
Exit;
vle.OnSetEditText := nil;
vle.Strings.BeginUpdate;
vle.Strings.Clear;
currenttab := tabs.Tabs[tabs.TabIndex];
CompilerSet := devCompilerSets[fCurrentIndex];
for I := 0 to CompilerSet.Options.Count - 1 do begin
option := PCompilerOption(CompilerSet.Options[I])^;
if SameStr(Lang[option.Section], currenttab) then begin
if Assigned(option.Choices) and (option.Value < option.Choices.Count) then
idx := vle.InsertRow(Lang[option.Name], option.Choices.Names[option.Value], True) // a,b,c,d
else
idx := vle.InsertRow(Lang[option.Name], BoolValYesNo[option.Value > 0], True); // No Yes
vle.Strings.Objects[idx] := Pointer(I);
vle.ItemProps[idx].EditStyle := esPickList;
vle.ItemProps[idx].ReadOnly := true;
if Assigned(option.Choices) then begin
for j := 0 to option.Choices.Count - 1 do
vle.ItemProps[idx].PickList.Add(option.Choices.Names[J]);
end else begin
vle.ItemProps[idx].PickList.Add(BoolValYesNo[False]);
vle.ItemProps[idx].PickList.Add(BoolValYesNo[True]);
end;
end;
end;
vle.ColWidths[0] := vle.ClientWidth - 90;
vle.ColWidths[1] := 90;
vle.OnSetEditText := vleSetEditText;
vle.Strings.EndUpdate;
end;
procedure TCompOptionsFrame.vleSetEditText(Sender: TObject; ACol, ARow: Integer; const Value: string);
var
option: PCompilerOption;
I: integer;
CompilerSet: TdevCompilerSet;
begin
if (fCurrentIndex >= devCompilerSets.Count) or (fCurrentIndex < 0) then
Exit;
CompilerSet := devCompilerSets[fCurrentIndex];
option := PCompilerOption(CompilerSet.Options[Integer(vle.Strings.Objects[ARow])]);
if SameStr(Value, 'Yes') then
option^.Value := 1
else if SameStr(Value, 'No') then
option^.Value := 0
else if Assigned(option^.Choices) then begin
for i := 0 to option^.Choices.Count - 1 do
if SameStr(Value, option^.Choices.Names[i]) then begin
option^.Value := i;
break;
end;
end;
// update string too
CompilerSet.SetOption(option, ValueToChar[option^.Value]);
end;
end.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.