project configuration wisget, synchro mode supports complex properties

e.g list of version identifiers, list of extra sources, etc
This commit is contained in:
Basile Burg 2015-05-22 06:25:35 +02:00
parent e83b5f6a55
commit edd48e92dc
1 changed files with 18 additions and 7 deletions

View File

@ -37,7 +37,8 @@ type
private private
fProj: TCEProject; fProj: TCEProject;
fSyncroMode: boolean; fSyncroMode: boolean;
fSyncroPropValue: string; fSynchroItem: TStringList;
fSynchroValue: TStringList;
function getGridTarget: TPersistent; function getGridTarget: TPersistent;
procedure setSyncroMode(aValue: boolean); procedure setSyncroMode(aValue: boolean);
function syncroSetPropAsString(const ASection, Item, Default: string): string; function syncroSetPropAsString(const ASection, Item, Default: string): string;
@ -79,18 +80,20 @@ begin
finally finally
png.Free; png.Free;
end; end;
fSynchroItem := TStringList.Create;
fSynchroValue := TStringList.Create;
Tree.Selected := Tree.Items.GetLastNode; Tree.Selected := Tree.Items.GetLastNode;
inspector.OnEditorFilter := @GridFilter; inspector.OnEditorFilter := @GridFilter;
inspector.CheckboxForBoolean := true; inspector.CheckboxForBoolean := true;
//TODO-cfeature: project inspector synchro-mode for dialog-based editors inspector.PropertyEditorHook.AddHandlerModified(@inspectorModified);
// currently the event OnModified is only called for simple properties.
// and it misses in ObjectINspector.pp TOICustomPropertyGrid.DoCallEdit();
// //
EntitiesConnector.addObserver(self); EntitiesConnector.addObserver(self);
end; end;
destructor TCEProjectConfigurationWidget.destroy; destructor TCEProjectConfigurationWidget.destroy;
begin begin
fSynchroItem.Free;
fSynchroValue.Free;
EntitiesConnector.removeObserver(self); EntitiesConnector.removeObserver(self);
inherited; inherited;
end; end;
@ -177,13 +180,18 @@ begin
end; end;
function TCEProjectConfigurationWidget.syncroSetPropAsString(const ASection, Item, Default: string): string; function TCEProjectConfigurationWidget.syncroSetPropAsString(const ASection, Item, Default: string): string;
var
i: Integer;
begin begin
result := fSyncroPropValue; i := fSynchroItem.IndexOf(Item);
if i = -1 then exit('');
result := fSynchroValue.Strings[i];
end; end;
procedure TCEProjectConfigurationWidget.syncroGetPropAsString(const ASection, Item, Value: string); procedure TCEProjectConfigurationWidget.syncroGetPropAsString(const ASection, Item, Value: string);
begin begin
fSyncroPropValue := Value; fSynchroItem.Add(Item);
fSynchroValue.Add(Value);
end; end;
procedure TCEProjectConfigurationWidget.inspectorModified(Sender: TObject); procedure TCEProjectConfigurationWidget.inspectorModified(Sender: TObject);
@ -255,7 +263,8 @@ begin
storage.free; storage.free;
src_list.free; src_list.free;
fProj.endUpdate; fProj.endUpdate;
fSyncroPropValue := ''; fSynchroItem.Clear;
fSynchroValue.Clear;
end; end;
end; end;
@ -310,6 +319,8 @@ end;
procedure TCEProjectConfigurationWidget.btnSyncEditClick(Sender: TObject); procedure TCEProjectConfigurationWidget.btnSyncEditClick(Sender: TObject);
begin begin
fSynchroValue.Clear;
fSynchroItem.Clear;
if fProj = nil then exit; if fProj = nil then exit;
syncroMode := not syncroMode; syncroMode := not syncroMode;
end; end;