- Timestamp:
- May 2, 2014, 2:12:56 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LinuxBuilder.lpi
r5 r6 33 33 </Item1> 34 34 </RequiredPackages> 35 <Units Count=" 6">35 <Units Count="7"> 36 36 <Unit0> 37 37 <Filename Value="LinuxBuilder.lpr"/> … … 76 76 <UnitName Value="UFormCompare"/> 77 77 </Unit5> 78 <Unit6> 79 <Filename Value="UFormSearch.pas"/> 80 <IsPartOfProject Value="True"/> 81 <ComponentName Value="FormSearch"/> 82 <ResourceBaseClass Value="Form"/> 83 <UnitName Value="UFormSearch"/> 84 </Unit6> 78 85 </Units> 79 86 </ProjectOptions> -
trunk/LinuxBuilder.lpr
r5 r6 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UFormMain, UKConfig, UFormList, UFormLog, UFormCompare 10 Forms, UFormMain, UKConfig, UFormList, UFormLog, UFormCompare, UFormSearch 11 11 { you can add units after this }; 12 12 … … 20 20 Application.CreateForm(TFormLog, FormLog); 21 21 Application.CreateForm(TFormCompare, FormCompare); 22 Application.CreateForm(TFormSearch, FormSearch); 22 23 Application.Run; 23 24 end. -
trunk/UFormMain.lfm
r5 r6 23 23 ReadOnly = True 24 24 RowSelect = True 25 ShowRoot = False 25 26 TabOrder = 0 26 27 OnSelectionChanged = TreeView1SelectionChanged 27 Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoShowButtons, tvoShowLines, tvo ShowRoot, tvoToolTips, tvoThemedDraw]28 Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw] 28 29 end 29 30 object StatusBar1: TStatusBar … … 61 62 Action = AShowList 62 63 end 64 object ToolButton3: TToolButton 65 Left = 47 66 Top = 2 67 Action = ASearch 68 end 69 object ToolButton4: TToolButton 70 Left = 70 71 Top = 2 72 Action = AShowLog 73 end 63 74 end 64 75 object Memo1: TMemo … … 80 91 object MenuItem4: TMenuItem 81 92 Action = AOpenDir 93 Bitmap.Data = { 94 36040000424D3604000000000000360000002800000010000000100000000100 95 2000000000000004000064000000640000000000000000000000000000000000 96 0000000000000000000000000000000000000000000000000000000000000000 97 0000000000000000000000000000000000000000000000000000000000000000 98 0000000000000000000000000000000000000000000000000000000000000000 99 0000000000000000000000000000000000000000000000000000000000FF0000 100 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000 101 00FF000000FF0000000000000000000000000000000000000000000000FF0000 102 00FF008484FF008484FF008484FF008484FF008484FF008484FF008484FF0084 103 84FF008484FF000000FF00000000000000000000000000000000000000FF00FF 104 FFFF000000FF008484FF008484FF008484FF008484FF008484FF008484FF0084 105 84FF008484FF008484FF000000FF000000000000000000000000000000FFFFFF 106 FFFF00FFFFFF000000FF008484FF008484FF008484FF008484FF008484FF0084 107 84FF008484FF008484FF008484FF000000FF0000000000000000000000FF00FF 108 FFFFFFFFFFFF00FFFFFF000000FF008484FF008484FF008484FF008484FF0084 109 84FF008484FF008484FF008484FF008484FF000000FF00000000000000FFFFFF 110 FFFF00FFFFFFFFFFFFFF00FFFFFF000000FF000000FF000000FF000000FF0000 111 00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF00FF 112 FFFFFFFFFFFF00FFFFFFFFFFFFFF00FFFFFFFFFFFFFF00FFFFFFFFFFFFFF00FF 113 FFFF000000FF0000000000000000000000000000000000000000000000FFFFFF 114 FFFF00FFFFFFFFFFFFFF00FFFFFFFFFFFFFF00FFFFFFFFFFFFFF00FFFFFFFFFF 115 FFFF000000FF0000000000000000000000000000000000000000000000FF00FF 116 FFFFFFFFFFFF00FFFFFF000000FF000000FF000000FF000000FF000000FF0000 117 00FF000000FF0000000000000000000000000000000000000000000000000000 118 00FF000000FF000000FF00000000000000000000000000000000000000000000 119 00000000000000000000000000FF000000FF000000FF00000000000000000000 120 0000000000000000000000000000000000000000000000000000000000000000 121 0000000000000000000000000000000000FF000000FF00000000000000000000 122 0000000000000000000000000000000000000000000000000000000000FF0000 123 00000000000000000000000000FF00000000000000FF00000000000000000000 124 0000000000000000000000000000000000000000000000000000000000000000 125 00FF000000FF000000FF00000000000000000000000000000000000000000000 126 0000000000000000000000000000000000000000000000000000000000000000 127 0000000000000000000000000000000000000000000000000000 128 } 82 129 end 83 130 object MenuItem7: TMenuItem … … 89 136 object MenuItem3: TMenuItem 90 137 Action = AViemSystem 138 Bitmap.Data = { 139 36040000424D3604000000000000360000002800000010000000100000000100 140 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF 141 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 142 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 143 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 144 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 145 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 146 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 147 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 148 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00030303000404 149 0400040404000404040A04040435040404650404047B04040488040404880404 150 047B04040465040404350404040A040404000404040003030300030303000404 151 0401040404390C0C0C80545454ACAAAAAAD88C8C8CF15E5E5EFE5E5E5EFE8C8C 152 8CF1AAAAAAD8545454AC0C0C0C80040404390404040103030300030303070404 153 045A3A3A3AA5C6C6C6E6E7E7E7FFA2A2A2FF645D5DFF9E8484FF9E8484FF645D 154 5DFFA2A2A2FFE7E7E7FFC6C6C6E63A3A3AA50404045A03030307030303414848 155 48B1E2E2E2F7EAEAEAFFEAEAEAFF646464FF816F6FFF7A6767FF7A6767FF816F 156 6FFF646464FFEAEAEAFFEAEAEAFFE2E2E2F7484848B103030341030303A07E7E 157 7ED0F0F0F0FFF0F0F0FFF0F0F0FF434343FFBAB2B2FF352E2EFF352E2EFF6D5F 158 5FFF434343FFF0F0F0FFF0F0F0FFF0F0F0FF7E7E7ED0030303A0030303484646 159 46BEE9E9E9F9F6F6F6FFF6F6F6FFBDBDBDFFFFFFFFFF9E9B9BFF413C3CFF4C46 160 46FF5C5C5CFFF6F6F6FFF6F6F6FFE9E9E9F9464646BE03030348010101080101 161 0171353535C6CACACAF0FBFBFBFFA6A6A6FF9B9B9BFF383737FF383737FF3838 162 38FFA6A6A6FFFBFBFBFFCACACAF0353535C60101017101010108010101000101 163 01010000004F070707B44D4D4DD8A9A9A9EE7E7E7EF9424242FF424242FF7E7E 164 7EF9A9A9A9EE4D4D4DD8070707B40000004F0101010101010100010101000101 165 0100000000000000000E0000004E00000094000000B6000000C8000000C80000 166 00B6000000940000004E0000000E000000000101010001010100FFFFFF00FFFF 167 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 168 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 169 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 170 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 171 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF 172 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 173 } 91 174 end 92 175 object MenuItem5: TMenuItem 93 176 Action = AShowList 177 Bitmap.Data = { 178 36040000424D3604000000000000360000002800000010000000100000000100 179 2000000000000004000064000000640000000000000000000000986B37FF976A 180 36FF966935FF966734FF956633FF946532FF946531FF936430FF92622FFF9261 181 2EFF91602DFF90602CFF905F2BFF8F5D2AFF8E5C29FF8D5B28FF996C38FFF8F7 182 F6FFF8F7F5FFF7F6F5FFF6F6F4FFF6F5F3FFF5F5F3FFF5F4F2FFF4F3F1FFF4F3 183 F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F0EEFFF1F0EDFF8E5D29FF996D3AFFF9F8 184 F7FF959594FF878787FF9B9A9AFFF7F6F4FFF6F5F3FFF6F5F3FFF5F4F2FFF4F3 185 F1FFF4F3F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F1EEFF8F5E2AFF9A6E3BFFF9F9 186 F8FF7C7C7CFFC4C4C4FF878787FFF7F6F5FF7A7A7AFF787878FF747474FF7171 187 70FF6D6D6CFF696968FF656565FF616161FFF2F1EFFF905F2BFF9B6F3CFFFAF9 188 F8FFBEBEBDFF929292FFBCBCBBFFF8F7F6FFF7F7F5FFF7F6F4FFF6F5F4FFF6F5 189 F3FFF5F4F2FFF5F4F2FFF4F3F1FFF4F2F0FFF3F2F0FF91602DFF9C703DFFFAFA 190 F9FFFAF9F9FFF9F9F8FFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6F5FFF6F5 191 F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FFF4F3F0FF92612EFF9D723EFFFBFB 192 FAFF9F9F9EFF7F7F7FFFAEAEADFFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6 193 F5FFF6F6F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FF92622FFF9D7340FFFCFB 194 FBFF818181FFC4C4C4FF8F8F8FFFFAF9F8FF7B7B7AFF797979FF757574FF7271 195 71FF6D6D6DFF696969FF666665FF626261FFF5F4F2FF936430FF9E7441FFFCFC 196 FCFFB5B5B5FF848484FFBEBDBDFFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FFF8F8 197 F6FFF8F7F5FFF7F6F5FFF7F6F4FFF6F5F3FFF6F5F3FF946531FF9F7542FFFDFD 198 FCFFFCFCFCFFFCFCFBFFFBFBFAFFFBFAFAFFFAFAF9FFFAF9F8FFF9F9F8FFF9F8 199 F7FFF8F8F6FFF8F7F6FFF7F6F5FFF7F6F4FFF6F5F4FF956633FFA07643FFFEFD 200 FDFF8C8C8CFF525252FFA4A4A4FFFBFBFAFFFBFBFAFFFAFAF9FFFAF9F8FFF9F9 201 F8FFF9F8F7FFF8F8F6FFF8F7F6FFF7F7F5FFF7F6F4FF966734FFA17844FFFEFE 202 FEFF5F5F5FFF949494FF535353FFFCFCFBFF7B7B7BFF797979FF757575FF7272 203 72FF6E6E6EFF6A6A69FF666666FF626262FFF7F7F5FF966935FFA17946FFFFFF 204 FFFF878787FF5D5D5DFFA0A0A0FFFDFCFCFFFCFCFBFFFCFBFBFFFBFBFAFFFBFA 205 F9FFFAFAF9FFFAF9F8FFF9F8F7FFF8F8F7FFF8F7F6FF976A36FFA27A47FFFFFF 206 FFFFFFFFFFFFFEFEFEFFFEFEFEFFFDFDFDFFFDFDFCFFFCFCFBFFFCFBFBFFFBFB 207 FAFFFBFAF9FFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FF986B37FFA37B48FFBEA2 208 7FFFBEA17EFFBDA17DFFBDA07CFFBD9F7CFFBC9F7BFFBB9E7AFFBB9D7AFFBB9D 209 79FFBA9C78FFB99B78FFB99A77FFB89A76FFB89975FF996C39FFA37B48FFA37B 210 48FFA27A47FFA27946FFA17845FFA07744FFA07643FF9F7542FF9E7441FF9E73 211 40FF9D723FFF9C713EFF9C703DFF9B6F3CFF9A6E3BFF9A6D3AFF 212 } 94 213 end 95 214 object MenuItem6: TMenuItem 96 215 Action = AShowLog 216 Bitmap.Data = { 217 36040000424D3604000000000000360000002800000010000000100000000100 218 200000000000000400006400000064000000000000000000000000000000858A 219 88A3858A88FF858A88FF858A88FF858A88FF858A88FF858A88FF858A88FF858A 220 88FF858A88FF858A88FF858A88FF858A88A3000000000000000000000000858A 221 88FFEEEEEEFFB2B2B2FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2 222 B2FFB1B1B1FFB2B2B2FFB2B2B2FF858A88FF000000000000000000000000858A 223 88FFFFFFFFFFECECECFFEBEBEBFFEAEAEAFFEAEAEAFFE9E9E9FFEBEBEBFFEAEA 224 EAFFEBEBEBFFECECECFFB2B2B2FF858A88FF000000000000000000000000858A 225 88FFFFFFFFFFDBDBDBFFCBCBCBFFC4C4C4FF000000FF02598FFF636363FF8C8C 226 8CFFCACACAFFDADADAFFB2B2B2FF858A88FF000000020000000000000000858A 227 88FFFFFFFFFFECECECFFECECECFFE9E9E9FF02598FFF26424CFF36576BFF0259 228 8FFF9D9D9DFFD6D6D6FFAEAEAEFF858A88FF000000000000000000000000858A 229 88FFFFFFFFFFDBDBDBFFCCCCCCFFCBCBCBFF757575FF395B70FF8AABC2FF5585 230 A3FF02598FFF8F8F8FFF868686FF858A88FF000000010000000000000000858A 231 88FFFFFFFFFFECECECFFECECECFFECECECFFEBEBEBFF02598FFFC4E5EDFF649F 232 C8FF5787A4FF02598FFF717171FF858A88FF000000000000000100000000858A 233 88FFFFFFFFFFDBDBDBFFCCCCCCFFCCCCCCFFCCCCCCFFB7B7B7FF02598FFFC5E6 234 EDFF68A6CEFF5784A0FF02598FFF858A88FF000000000000000100000000858A 235 88FFFFFFFFFFECECECFFECECECFFECECECFFECECECFFECECECFFD3D3D3FF0259 236 8FFFC6EAEEFF69AACFFF5683A0FF02598FFF02598F330000000000000000858A 237 88FFFFFFFFFFDBDBDBFFCCCCCCFFCCCCCCFFCCCCCCFFCCCCCCFFCCCCCCFFB7B7 238 B7FF02598FFFC7EBEFFF6AACD2FF5787A4FF02598FFF02598F3300000000858A 239 88FFFFFFFFFFECECECFFECECECFFECECECFFECECECFFECECECFFECECECFFECEC 240 ECFFD3D3D3FF02598FFFC7EBEFFF6AACD2FF5583A1FC02598FFF00000000858A 241 88FFEBEBEBFF00A0C4FFBCBCBCFF00A0C4FFB8B8B8FF00A0C4FFB8B8B8FF00A0 242 C4FFB8B8B8FF00A0C4FF02598FFFC6EAEEFF71ADCFFF02598FFF00000000858A 243 88FF00A0C4FF3DB1EBFF00A0C4FF3DB1EBFF00A0C4FF3DB1EBFF00A0C4FF3DB1 244 EBFF00A0C4FF3DB1EBFF00A0C4FF02598FFF02598FFF02598F5C00000000858A 245 886600A0C4FFC6E8F9FF00A0C4FFC6E8F9FF00A0C4FFC6E8F9FF00A0C4FFC6E8 246 F9FF00A0C4FFC6E8F9FF00A0C4FF000000000000000000000000000000000000 247 000000A0C44400A0C4FF00A0C44400A0C4FF00A0C44400A0C4FF00A0C44400A0 248 C4FF00A0C44400A0C4FF00A0C444000000000000000000000000000000000000 249 0000000000000000000000000000000000000000000000000000000000000000 250 0000000000000000000000000000000000000000000000000000 251 } 252 end 253 object MenuItem8: TMenuItem 254 Action = ASearch 97 255 end 98 256 end … … 100 258 object ActionList1: TActionList 101 259 Images = ImageList1 102 left = 2 39260 left = 240 103 261 top = 264 104 262 object AOpenDir: TAction … … 125 283 Caption = 'Compare with directory' 126 284 OnExecute = ACompareExecute 285 end 286 object ASearch: TAction 287 Caption = 'Search' 288 OnExecute = ASearchExecute 289 ShortCut = 16454 127 290 end 128 291 end -
trunk/UFormMain.pas
r5 r6 15 15 TFormMain = class(TForm) 16 16 ACompare: TAction; 17 ASearch: TAction; 17 18 AShowList: TAction; 18 19 AShowLog: TAction; … … 30 31 MenuItem6: TMenuItem; 31 32 MenuItem7: TMenuItem; 33 MenuItem8: TMenuItem; 32 34 StatusBar1: TStatusBar; 33 35 ToolBar1: TToolBar; 34 36 ToolButton1: TToolButton; 35 37 ToolButton2: TToolButton; 38 ToolButton3: TToolButton; 39 ToolButton4: TToolButton; 36 40 TreeView1: TTreeView; 37 41 procedure ACompareExecute(Sender: TObject); 38 42 procedure AOpenDirExecute(Sender: TObject); 43 procedure ASearchExecute(Sender: TObject); 39 44 procedure AShowListExecute(Sender: TObject); 40 45 procedure AShowLogExecute(Sender: TObject); … … 49 54 Config: TConfigMenu; 50 55 procedure Reload; 56 procedure FocusTreeNode(Node: TMenuNode); 51 57 end; 52 58 … … 57 63 58 64 uses 59 UFormList, UFormLog, UFormCompare ;65 UFormList, UFormLog, UFormCompare, UFormSearch; 60 66 61 67 {$R *.lfm} … … 96 102 end; 97 103 104 procedure TFormMain.FocusTreeNode(Node: TMenuNode); 105 var 106 TreeNode: TTreeNode; 107 begin 108 TreeNode := TreeView1.Items.FindNodeWithData(Node); 109 if Assigned(TreeNode) then begin 110 TreeNode.Selected := True; 111 TreeNode.ExpandParents; 112 end; 113 end; 114 98 115 procedure TFormMain.AOpenDirExecute(Sender: TObject); 99 116 var … … 104 121 Reload; 105 122 end; 123 end; 124 125 procedure TFormMain.ASearchExecute(Sender: TObject); 126 begin 127 FormSearch.Show; 106 128 end; 107 129 -
trunk/UKConfig.pas
r5 r6 31 31 Items: TObjectList; // TList<TMenuNode> 32 32 Parent: TMenuNode; 33 NewParent: TMenuNode; 33 34 DefaultValue: string; 34 35 ValueType: TValueType; … … 37 38 constructor Create; virtual; 38 39 destructor Destroy; override; 40 function HaveUpperNode(Node: TMenuNode): Boolean; 39 41 function GetName: string; virtual; 40 function Get absoluteName: string; virtual;42 function GetAbsoluteName: string; virtual; 41 43 procedure LoadTreeNode(Node: TTreeNode; Options: TLoadTreeOptions = []); virtual; 42 44 procedure LoadStats(List: TStrings); virtual; 43 45 procedure GetNodes(List: TStrings); virtual; 46 procedure Search(Text: string; List: TObjectList); virtual; 44 47 procedure SaveToList(List: TStrings); virtual; 45 48 procedure PrepareMoveList(Lookup: TStringList; var List: TObjectMoves); virtual; … … 56 59 private 57 60 CurrentMenu: TMenuNode; 61 ConditionStack: TStringList; 58 62 Arch: string; 59 63 FOnLog: TOnLogEvent; 64 function GetTopCondition: string; 60 65 procedure Log(Text: string); 61 66 function IsWhiteSpace(Character: Char): Boolean; 62 67 function GetNextToken(var Text: string): string; 63 68 procedure ParseFile(FileName: string); 69 procedure ParseConfig; 70 procedure ParseMakeFile; 64 71 public 65 72 TopNode: TMenuNode; 66 73 BaseDir: string; 74 Version: string; 67 75 procedure PrepareMoveList(var List: TObjectMoves); 68 76 procedure CompareStringLists(List1, List2: TStringList; Missing1, … … 70 78 procedure LoadFromDir(Dir: string; Arch: string); 71 79 property OnLog: TOnLogEvent read FOnLog write FOnLog; 80 constructor Create; 81 destructor Destroy; override; 72 82 end; 73 83 … … 96 106 end; 97 107 108 function TMenuNode.HaveUpperNode(Node: TMenuNode): Boolean; 109 begin 110 Result := False; 111 if NewParent = Node then Result := True 112 else if Assigned(NewParent) then Result := NewParent.HaveUpperNode(Node); 113 end; 114 98 115 function TMenuNode.GetName: string; 99 116 begin … … 102 119 end; 103 120 104 function TMenuNode.Get absoluteName: string;105 begin 106 if Assigned(Parent) then Result := Parent.Get absoluteName + ' - ';107 Result := Result + GetName;121 function TMenuNode.GetAbsoluteName: string; 122 begin 123 if Assigned(Parent) then Result := Parent.GetAbsoluteName + ' - '; 124 if Assigned(Parent) then Result := Result + GetName; 108 125 end; 109 126 … … 119 136 NewNode.Data := TMenuNode(Self.Items[I]); 120 137 LoadTreeNode(NewNode, Options); 121 end ;138 end else LoadTreeNode(Node, Options); 122 139 end; 123 140 end; … … 149 166 end; 150 167 168 procedure TMenuNode.Search(Text: string; List: TObjectList); 169 var 170 I: Integer; 171 begin 172 if (Pos(Text, ID) > 0) or (Pos(Text, Name) > 0) then List.Add(Self); 173 for I := 0 to Items.Count - 1 do 174 TMenuNode(Items[I]).Search(Text, List); 175 end; 176 151 177 procedure TMenuNode.SaveToList(List: TStrings); 152 178 var … … 167 193 Index: Integer; 168 194 begin 195 if ID = 'KVM_INTEL' then 196 Name := Name + '$'; 197 NewParent := Parent; 198 if Condition <> '' then begin 199 Index := Lookup.IndexOf(Condition); 200 if Index <> -1 then Node := TMenuNode(Lookup.Objects[Index]) 201 else Node := nil; 202 if Assigned(Node) and (NewParent <> Node) then begin 203 NewParent := Node; 204 end; 205 end; 169 206 if Depends.Count > 0 then begin 170 207 Index := Lookup.IndexOf(Depends[0]); 171 208 if Index <> -1 then Node := TMenuNode(Lookup.Objects[Index]) 172 209 else Node := nil; 173 if Assigned(Node) and (Parent <> Node) then begin 174 NewMove.Source := Self; 175 NewMove.NewParent := Node; 176 SetLength(List, Length(List) + 1); 177 List[Length(List) - 1] := NewMove; 210 if Assigned(Node) and (NewParent <> Node) and (Node.HaveUpperNode(NewParent)) then begin 211 NewParent := Node; 178 212 end; 179 end else 180 if Condition <> '' then begin 181 Index := Lookup.IndexOf(Condition); 182 if Index <> -1 then Node := TMenuNode(Lookup.Objects[Index]) 183 else Node := nil; 184 if Assigned(Node) and (Parent <> Node) then begin 185 NewMove.Source := Self; 186 NewMove.NewParent := Node; 187 SetLength(List, Length(List) + 1); 188 List[Length(List) - 1] := NewMove; 189 end; 190 end; 213 end; 214 if NewParent <> Parent then begin 215 NewMove.Source := Self; 216 NewMove.NewParent := NewParent; 217 SetLength(List, Length(List) + 1); 218 List[Length(List) - 1] := NewMove; 219 end; 220 191 221 I := 0; 192 222 while I < Items.Count do … … 231 261 232 262 { TConfigMenu } 263 264 function TConfigMenu.GetTopCondition: string; 265 begin 266 if ConditionStack.Count > 0 then 267 Result := ConditionStack[ConditionStack.Count - 1] 268 else Result := ''; 269 end; 233 270 234 271 procedure TConfigMenu.Log(Text: string); … … 285 322 NewMenu: TMenuNode; 286 323 MergedLines: string; 287 Condition: string;288 324 HelpIndent: Integer; 289 325 LineIndent: Integer; … … 302 338 NewItem := nil; 303 339 MergedLines := ''; 304 Condition := '';305 340 HelpIndent := 0; 306 341 for I := 0 to Content.Count - 1 do begin … … 394 429 if Parameter = 'on' then begin 395 430 Parameter := GetNextToken(Line); 431 if Copy(Parameter, 1, 1) = '!' then Delete(Parameter, 1, 1); 396 432 if not Assigned(NewItem) then raise Exception.Create('Item not defined. ' + GetLog); 397 433 NewItem.Depends.Add(Parameter); … … 413 449 if (Command = 'config') or (Command = 'menuconfig') then begin 414 450 Parameter := GetNextToken(Line); 415 State := stConfig; 416 NewItem := TMenuNode.Create; 417 NewItem.Parent := CurrentMenu; 418 NewItem.ID := Parameter; 419 NewItem.Condition := Condition; 420 CurrentMenu.Items.Add(NewItem); 421 end else 422 if (Command = 'comment') then begin 423 Parameter := GetNextToken(Line); 424 NewItem := TMenuNode.Create; 425 NewItem.Parent := CurrentMenu; 426 NewItem.ID := Parameter; 427 NewItem.Condition := Condition; 428 NewItem.ValueType := vtComment; 429 CurrentMenu.Items.Add(NewItem); 430 end else 431 if Command = 'source' then begin 432 Parameter := GetNextToken(Line); 433 if Pos('$SRCARCH', Parameter) > 0 then 434 Parameter := StringReplace(Parameter, '$SRCARCH', Arch, [rfReplaceAll]); 435 Parameter := BaseDir + DirectorySeparator + Parameter; 436 if FileExistsUTF8(Parameter) then 437 ParseFile(Parameter) 438 else raise Exception.Create('Source file "' + Parameter + '" not found. ' + GetLog); 439 end else 440 if Command = 'choice' then begin 441 Parameter := GetNextToken(Line); 442 NewMenu := TMenuNode.Create; 443 NewMenu.ValueType := vtChoice; 444 NewMenu.Name := Parameter; 445 NewMenu.Parent := CurrentMenu; 446 NewItem := NewMenu; 447 CurrentMenu.Items.Add(NewMenu); 448 CurrentMenu := NewMenu; 449 end else 450 if command = 'endchoice' then begin 451 if Assigned(CurrentMenu.Parent) then 452 CurrentMenu := CurrentMenu.Parent 453 else raise Exception.Create('Can''t change menu level up. ' + GetLog); 454 end else 455 if Command = 'mainmenu' then begin 456 Parameter := GetNextToken(Line); 457 TopNode.Name := Parameter; 458 end else 459 if Command = 'menu' then begin 460 Parameter := GetNextToken(Line); 461 Log('MENU ' + Parameter + ' IN ' + CurrentMenu.GetAbsoluteName); 462 NewMenu := TMenuNode.Create; 463 NewMenu.Name := Parameter; 464 NewMenu.Parent := CurrentMenu; 465 NewMenu.Condition := Condition; 466 Condition := ''; 467 NewItem := NewMenu; 468 CurrentMenu.Items.Add(NewMenu); 469 CurrentMenu := NewMenu; 470 end else 471 if command = 'endmenu' then begin 472 Log('ENDMENU ' + CurrentMenu.GetAbsoluteName); 473 if Assigned(CurrentMenu.Parent) then begin 474 Condition := CurrentMenu.Condition; 475 CurrentMenu := CurrentMenu.Parent; 476 end else raise Exception.Create('Can''t change menu level up. ' + GetLog); 477 end else 478 if Command = 'if' then begin 479 Condition := GetNextToken(Line); 480 end else 481 if Command = 'visible' then begin 482 //VisibleCondition := GetNextToken(Line); 483 end else 484 if command = 'endif' then begin 485 Condition := ''; 486 end else 487 raise Exception.Create('Unknown command "' + Command + '". ' + GetLog); 451 State := stConfig; 452 NewItem := TMenuNode.Create; 453 NewItem.Parent := CurrentMenu; 454 NewItem.ID := Parameter; 455 NewItem.Condition := GetTopCondition; 456 CurrentMenu.Items.Add(NewItem); 457 end else 458 if (Command = 'comment') then begin 459 Parameter := GetNextToken(Line); 460 NewItem := TMenuNode.Create; 461 NewItem.Parent := CurrentMenu; 462 NewItem.Name := Parameter; 463 NewItem.Condition := GetTopCondition; 464 NewItem.ValueType := vtComment; 465 CurrentMenu.Items.Add(NewItem); 466 end else 467 if Command = 'source' then begin 468 Parameter := GetNextToken(Line); 469 if Pos('$SRCARCH', Parameter) > 0 then 470 Parameter := StringReplace(Parameter, '$SRCARCH', Arch, [rfReplaceAll]); 471 Parameter := BaseDir + DirectorySeparator + Parameter; 472 if FileExistsUTF8(Parameter) then 473 ParseFile(Parameter) 474 else raise Exception.Create('Source file "' + Parameter + '" not found. ' + GetLog); 475 end else 476 if Command = 'choice' then begin 477 Parameter := GetNextToken(Line); 478 NewMenu := TMenuNode.Create; 479 NewMenu.ValueType := vtChoice; 480 NewMenu.Name := Parameter; 481 NewMenu.Parent := CurrentMenu; 482 NewMenu.Condition := GetTopCondition; 483 ConditionStack.Add(''); 484 NewItem := NewMenu; 485 CurrentMenu.Items.Add(NewMenu); 486 CurrentMenu := NewMenu; 487 end else 488 if command = 'endchoice' then begin 489 if Assigned(CurrentMenu.Parent) then begin 490 ConditionStack.Delete(ConditionStack.Count - 1); 491 CurrentMenu := CurrentMenu.Parent; 492 end else raise Exception.Create('Can''t change menu level up. ' + GetLog); 493 end else 494 if Command = 'mainmenu' then begin 495 Parameter := GetNextToken(Line); 496 Parameter := StringReplace(Parameter, '$ARCH', Arch, [rfReplaceAll]); 497 Parameter := StringReplace(Parameter, '$KERNELVERSION', Version, [rfReplaceAll]); 498 TopNode.Name := Parameter; 499 end else 500 if Command = 'menu' then begin 501 Parameter := GetNextToken(Line); 502 Log('MENU ' + Parameter + ' IN ' + CurrentMenu.GetAbsoluteName); 503 NewMenu := TMenuNode.Create; 504 NewMenu.Name := Parameter; 505 NewMenu.Parent := CurrentMenu; 506 NewMenu.Condition := GetTopCondition; 507 ConditionStack.Add(''); 508 NewItem := NewMenu; 509 CurrentMenu.Items.Add(NewMenu); 510 CurrentMenu := NewMenu; 511 end else 512 if command = 'endmenu' then begin 513 Log('ENDMENU ' + CurrentMenu.GetAbsoluteName); 514 if Assigned(CurrentMenu.Parent) then begin 515 ConditionStack.Delete(ConditionStack.Count - 1); 516 CurrentMenu := CurrentMenu.Parent; 517 end else raise Exception.Create('Can''t change menu level up. ' + GetLog); 518 end else 519 if Command = 'if' then begin 520 ConditionStack.Add(GetNextToken(Line)); 521 end else 522 if Command = 'visible' then begin 523 //VisibleCondition := GetNextToken(Line); 524 end else 525 if command = 'endif' then begin 526 ConditionStack.Delete(ConditionStack.Count - 1); 527 end else 528 raise Exception.Create('Unknown command "' + Command + '". ' + GetLog); 529 end; 530 finally 531 Content.Free; 532 end; 533 end; 534 535 procedure TConfigMenu.ParseConfig; 536 begin 537 ConditionStack.Clear; 538 TopNode.Free; 539 TopNode := TMenuNode.Create; 540 TopNode.Name := 'Root'; 541 CurrentMenu := TopNode; 542 ParseFile(BaseDir + DirectorySeparator + 'Kconfig'); 543 end; 544 545 procedure TConfigMenu.ParseMakeFile; 546 var 547 Content: TStringList; 548 I: Integer; 549 Line: string; 550 Token: string; 551 begin 552 try 553 Content := TStringList.Create; 554 Content.LoadFromFile(BaseDir + DirectorySeparator + 'Makefile'); 555 for I := 0 to Content.Count - 1 do begin 556 Line := Trim(Content[I]); 557 Token := GetNextToken(Line); 558 if Token = 'VERSION' then begin 559 Line := Trim(Line); 560 Token := GetNextToken(Line); 561 if Token = '=' then 562 Version := Trim(Line); 563 end else 564 if Token = 'PATCHLEVEL' then begin 565 Line := Trim(Line); 566 Token := GetNextToken(Line); 567 if Token = '=' then 568 Version := Version + '.' + Trim(Line); 569 end else 570 if Token = 'SUBLEVEL' then begin 571 Line := Trim(Line); 572 Token := GetNextToken(Line); 573 if Token = '=' then 574 Version := Version + '.' + Trim(Line); 575 end; 488 576 end; 489 577 finally … … 548 636 Self.Arch := Arch; 549 637 BaseDir := Dir; 550 TopNode.Free; 551 TopNode := TMenuNode.Create; 552 TopNode.Name := 'Root'; 553 CurrentMenu := TopNode; 554 ParseFile(BaseDir + DirectorySeparator + 'Kconfig'); 555 638 ParseMakeFile; 639 ParseConfig; 640 641 SetLength(Moves, 0); 556 642 PrepareMoveList(Moves); 557 643 for I := 0 to Length(Moves) - 1 do … … 565 651 end; 566 652 653 constructor TConfigMenu.Create; 654 begin 655 ConditionStack := TStringList.Create; 656 end; 657 658 destructor TConfigMenu.Destroy; 659 begin 660 ConditionStack.Free; 661 end; 662 567 663 end. 568 664
Note:
See TracChangeset
for help on using the changeset viewer.