if (IsRunning)
delUnlockRenderMutex();
}
-
+
bool dirtyState = false;
bool DirtyState {
get {
fiWidget_design_id = typeWidget.GetField("design_id");
fiWidget_design_style_values = typeWidget.GetField("design_style_values");
fiWidget_design_style_locations = typeWidget.GetField("design_style_locations");
+ fiWidget_design_iml_locations = typeWidget.GetField("design_iml_locations");
fiWidget_design_iml_values = typeWidget.GetField("design_iml_values");
fiWidget_design_line = typeWidget.GetField("design_line");
fiWidget_design_column = typeWidget.GetField("design_column");
public Project CurrentSolution {
get => currentSolution;
set {
- //CERoslynPlugin.SolutionProject sol = value as CERoslynPlugin.SolutionProject;
if (currentSolution == value)
return;
currentSolution = value;
public Document CurrentDocument {
get => currentDocument;
set {
- //CERoslynPlugin.SolutionProject sol = value as CERoslynPlugin.SolutionProject;
if (currentDocument == value)
return;
currentDocument = value;
NotifyValueChanged (currentDocument);
-
- /*if (currentDocument is ImlDocument iml) {
- LoadIML(iml.source.ToString());
- }*/
}
}
public class ForeignWidgetContainer : CrowEditComponent {
internal static Type typeWidget;//, typeGroup, typeContainer, typeTemplatedContainer, typeTemplatedGroup;
//design mode members, present only if crow compiled with DESIGN_MODE enabled
- internal static FieldInfo fiWidget_design_id, fiWidget_design_style_values, fiWidget_design_iml_values, fiWidget_design_style_locations,
+ internal static FieldInfo fiWidget_design_id,
+ fiWidget_design_style_values, fiWidget_design_iml_values,
+ fiWidget_design_style_locations, fiWidget_design_iml_locations,
fiWidget_design_line, fiWidget_design_column, fiWidget_design_imlPath,
fiWidget_slot;
Func<string> delGetName;
designColumn = (int)fiWidget_design_column?.GetValue(instance);
designImlPath = (string)fiWidget_design_imlPath?.GetValue(instance);
- //Console.WriteLine($"new ForeignWidgetContainer: {this} {parent}");
+ //onsole.WriteLine($"new ForeignWidgetContainer: {this} {parent} {designImlPath}");
}
public Dictionary<string,string> ImlValues => fiWidget_design_iml_values.GetValue(instance) as Dictionary<string,string>;
public Dictionary<string,string> StyleValues => fiWidget_design_style_values.GetValue(instance) as Dictionary<string,string>;
public Dictionary<string,FileLocation> StyleLocation => fiWidget_design_style_locations.GetValue(instance) as Dictionary<string,FileLocation>;
+ public Dictionary<string,FileLocation> ImlLocation => fiWidget_design_iml_locations.GetValue(instance) as Dictionary<string,FileLocation>;
public virtual bool IsExpanded {
get => isExpanded;
ForeignWidgetContainer host;
PropertyInfo pi;
- Command cmdReset, cmdGoToStyle;
+ Command cmdReset, cmdGoToStyle, cmdGoToIml;
public CommandGroup Commands;
#region CTOR
cmdReset = new ActionCommand ("Reset to default", Reset, "", HasStyling | IsSetByIML);
cmdGoToStyle = new ActionCommand ("Goto style", GotoStyle, "#icons.edit.svg", HasStyling);
+ cmdGoToIml = new ActionCommand ("Goto Iml", GotoIml, "#icons.edit.svg", HasImlLocation);
- Commands = new CommandGroup (cmdReset, cmdGoToStyle);
+ Commands = new CommandGroup (cmdReset, cmdGoToStyle, cmdGoToIml);
}
#endregion
public string DesignCategory {
get {
DesignCategory dca = (DesignCategory)pi.GetCustomAttribute (typeof(DesignCategory));
- return dca == null ? "Divers" : dca.Name;
+ return dca == null ? "Divers" : dca.Name;
}
}
public string Name => pi.Name;
/// return true if current value comes from IML attributes
/// </summary>
public bool IsSetByIML => host.ImlValues.ContainsKey (Name);
+ public bool HasImlLocation => host.ImlLocation.ContainsKey(Name);
/// <summary>
/// return true if member default value comes from style
/// </summary>
if (srv.CurrentSolution.TryGetFile(fl.FilePath, out IFileNode node)) {
if (App.OpenFile(node.FullPath) is TextDocument doc) {
doc.IsSelected = true;
- doc.SetLocation(new CharLocation(fl.Line, fl.Column));
+ doc.SetLocation(new CharLocation(fl.Line, fl.Column + doc.GetLineText(fl.Line).CountLeadingWhiteSpaces()));
}
}
pf.IsSelected = true;*/
}
+ public void GotoIml(){
+ if (!HasImlLocation)
+ return;
+ FileLocation fl = host.ImlLocation[Name];
+ Debug.WriteLine($"goto iml: {fl.FilePath}");
+ CrowService srv = App.GetService<CrowService> ();
+ if (srv.CurrentDocument is ImlDocument iml) {
+ iml.SetLocation(new CharLocation(fl.Line, fl.Column + iml.GetLineText(fl.Line).CountLeadingWhiteSpaces()));
+ }
+ }
public override string ToString () => $"{Name} = {Value}";
+ public override bool IsSelected {
+ get => base.IsSelected;
+ set {
+ base.IsSelected = value;
+ if (isSelected && HasImlLocation)
+ GotoIml();
+ }
+ }
}
}
<Label Text="{DesignPath}" />
<Label Text="{DesignLine}" />
<Label Text="{DesignColumn}" />
- </HorizontalStack>
+ </HorizontalStack>
<HorizontalStack Margin="1">
<Scroller Name="ItemsScroller" Margin="2">
<VerticalStack Height="Fit" MinimumSize="10,10"
<TextBox Margin="1" Text="{²Value}" Height="Fit" Foreground="{LabForeground}" Font="mono, 12"/>
</HorizontalStack>
</ListItem>
- </ItemTemplate>
+ </ItemTemplate>
</ListBox>
</VerticalStack>
</DockWindow>