<EmbeddedResource Include="ui\DockWindows\winEditor.crow" />
<EmbeddedResource Include="ui\DockWindows\winErrors.crow" />
<EmbeddedResource Include="ui\DockWindows\winSolution.crow" />
+ <EmbeddedResource Include="ui\DockWindows\winProperties.crow" />
</ItemGroup>
<ItemGroup>
<None Include="ui\test.crow">
public Command CMDNew, CMDOpen, CMDSave, CMDSaveAs, CMDQuit,
CMDUndo, CMDRedo, CMDCut, CMDCopy, CMDPaste, CMDHelp,
CMDAbout, CMDOptions,
- CMDViewGTExp, CMDViewProps, CMDViewProj, CMDViewProjProps, CMDViewErrors, CMDViewSolution,
+ CMDViewGTExp, CMDViewProps, CMDViewProj, CMDViewProjProps, CMDViewErrors, CMDViewSolution, CMDViewEditor, CMDViewProperties,
CMDCompile;
void initCommands () {
{ Caption = "Errors pane"};
CMDViewSolution = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winSolution.crow")))
{ Caption = "Solution Tree"};
+ CMDViewEditor = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow")))
+ { Caption = "Editor Pane"};
+ CMDViewProperties = new Command(new Action(() => loadDockWindow ("#Crow.Coding.ui.DockWindows.winProperties.crow")))
+ { Caption = "Properties"};
CMDViewGTExp = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.GTreeExplorer.crow"))) { Caption = "Graphic Tree Explorer"};
CMDViewProps = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.MemberView.crow"))) { Caption = "Properties View"};
instFileDlg = Instantiator.CreateFromImlFragment
(MainIFace, "<FileDialog Caption='Open File' CurrentDirectory='{²CurrentDirectory}' SearchPattern='*.sln' OkClicked='onFileOpen'/>");
+
+ DockWindow dw = loadDockWindow ("#Crow.Coding.ui.DockWindows.winEditor.crow");
+ dw.DockingPosition = Alignment.Center;
+ dw.Dock (mainDock.Children [0] as DockStack);
}
void loadProjProps () {
// loadWindow ("#Crow.Coding.ui.CSProjExplorer.crow");
// }
}
- void loadDockWindow(string path){
+ DockWindow loadDockWindow(string path){
lock (MainIFace.UpdateMutex) {
- try {
- GraphicObject g = MainIFace.FindByName (path);
- if (g != null)
- return;
- g = MainIFace.Load (path);
- mainDock.AddChild (g);
- g.Name = path;
- g.DataSource = CurrentSolution;
- } catch (Exception ex) {
- System.Diagnostics.Debug.WriteLine (ex.ToString ());
+ GraphicObject g = MainIFace.FindByName (path);
+ if (g == null){
+ try {
+ g = MainIFace.Load (path);
+ mainDock.AddChild (g);
+ g.Name = path;
+ g.DataSource = CurrentSolution;
+ } catch (Exception ex) {
+ System.Diagnostics.Debug.WriteLine (ex.ToString ());
+ }
}
+ return g as DockWindow;
}
}
void loadWindow(string path, object dataSource = null){
}
if (cl.Tokens [tokPtr].Type == TokenType.LineComment && onlyWhiteSpace) {
- currentNode = addChildNode (currentNode, cl, tokPtr);
+ int startLine = ptrLine;
ptrLine++;
while (ptrLine < buffer.LineCount) {
int idx = buffer [ptrLine].FirstNonBlankTokIndex;
break;
ptrLine++;
}
- closeNodeAndGoUp (ref currentNode, buffer [ptrLine]);
+ ptrLine--;
+ if (ptrLine - startLine > 0) {
+ currentNode = addChildNode (currentNode, cl, tokPtr);
+ closeNodeAndGoUp (ref currentNode, buffer [ptrLine]);
+ }
break;
}
case TokenType.CloseBlock:
closeNodeAndGoUp (ref currentNode, cl);
break;
+ case TokenType.Preprocessor:
+ if (cl.Tokens [tokPtr].Content.StartsWith ("#region")) {
+ currentNode = addChildNode (currentNode, cl, tokPtr);
+ }else if (cl.Tokens [tokPtr].Content.StartsWith("#endregion"))
+ closeNodeAndGoUp (ref currentNode, cl);
+ break;
}
onlyWhiteSpace = false;
tokPtr++;
int i = 0, vl = 0;
editMutex.EnterReadLock ();
while (i < LineCount) {
- if (this [i].IsFolded)
+ if (this [i].IsFolded) {
i = GetEndNodeIndex (i);
+ if (i < 0) {
+ Console.WriteLine ("error folding");
+ break;
+ }
+ }
i++;
vl++;
}
//LineUpadateEvent.Raise (this, new CodeBufferEventArgs (i));
}
}
- public bool IsFoldable { get { return SyntacticNode != null; } }
+ public bool IsFoldable { get { return SyntacticNode == null ? false :
+ SyntacticNode.EndLine != SyntacticNode.StartLine && SyntacticNode.EndLine != null; } }
+ public int FoldingLevel { get { return IsFoldable ? SyntacticNode.Level : 0; } }
public bool IsFolded = false;
public bool IsParsed {
get { return Tokens != null; }
Children.Add (child);
}
+ public int Level {
+ get { return Parent == null ? 1 : Parent.Level + 1; }
+ }
+
public override string ToString ()
{
return string.Format ("Name:{0}, Type:{1}\n\tparent:{2}", Name, Type, Parent);
}
const int leftMarginGap = 3;//gap between items in margin and text
const int foldSize = 9;//folding rectangles size
+ const int foldMargin = 30;//folding rectangles size
#region private and protected fields
bool foldingEnabled = true;
if (PrintLineNumbers)
leftMargin += (int)Math.Ceiling((double)buffer.LineCount.ToString().Length * fe.MaxXAdvance) +6;
if (foldingEnabled)
- leftMargin += foldSize;
+ leftMargin += foldMargin;
if (leftMargin > 0)
leftMargin += leftMarginGap;
updateVisibleColumns ();
}
+
//draw folding
if (foldingEnabled){
+
+ Rectangle rFld = new Rectangle (cb.X + leftMargin - leftMarginGap - foldMargin,
+ (int)(y + (fe.Ascent + fe.Descent) / 2.0 - foldSize / 2.0), foldSize, foldSize);
+
+ gr.SetSourceColor (Color.Black);
+
+ int level = 0;
+
+ if (currentNode != null) {
+ if (cl == currentNode.EndLine)
+ currentNode = currentNode.Parent;
+ if (currentNode != null)
+ level = currentNode.Level;
+ }
+
+ rFld.Left += level * 5;
+
if (cl.IsFoldable) {
- if (cl.SyntacticNode.StartLine != cl.SyntacticNode.EndLine) {
- gr.SetSourceColor (Color.Black);
- Rectangle rFld = new Rectangle (cb.X + leftMargin - leftMarginGap - foldSize, (int)(y + (fe.Ascent+fe.Descent) / 2.0 - foldSize / 2.0), foldSize, foldSize);
- gr.Rectangle (rFld, 1.0);
- if (cl.IsFolded) {
- gr.MoveTo (rFld.Center.X + 0.5, rFld.Y + 2);
- gr.LineTo (rFld.Center.X + 0.5, rFld.Bottom - 2);
- }
- gr.MoveTo (rFld.Left + 2, rFld.Center.Y + 0.5);
- gr.LineTo (rFld.Right - 2, rFld.Center.Y + 0.5);
- gr.Stroke ();
- }
+ gr.Rectangle (rFld, 1.0);
+ if (cl.IsFolded) {
+ gr.MoveTo (rFld.Center.X + 0.5, rFld.Y + 2);
+ gr.LineTo (rFld.Center.X + 0.5, rFld.Bottom - 2);
+ }else
+ currentNode = cl.SyntacticNode;
+
+ gr.MoveTo (rFld.Left + 2, rFld.Center.Y + 0.5);
+ gr.LineTo (rFld.Right - 2, rFld.Center.Y + 0.5);
+ gr.Stroke ();
+
+// } else if (currentNode != null){
+// if (cl == currentNode.EndLine)
+// currentNode = currentNode.Parent;
+// if (currentNode != null) {
+// int level = currentNode.Level;
+// gr.MoveTo (rFld.Center.X + 0.5 + level * 5, y);
+// gr.LineTo (rFld.Center.X + 0.5 + level * 5, y + fe.Ascent + fe.Descent);
+// gr.Stroke ();
+// }
}
}
else
drawParsedCodeLine (gr, x, y, i, lineIndex);
}
+ Node currentNode = null;
// void drawParsed(Context gr){
// if (PrintedLines == null)
// return;
seMutex.EnterReadLock ();
- if (PrintedLines != null) {
+ if (PrintedLines != null) {
+ int unfoldedLines = buffer.UnfoldedLines;
+ currentNode = null;
+ CodeLine cl = PrintedLines[0];
+ int li = buffer.IndexOf(cl);
+ while (li > 0) {
+ if (buffer [li].IsFoldable) {
+ currentNode = buffer [li].SyntacticNode;
+ break;
+ }
+ li--;
+ }
+
for (int i = 0; i < visibleLines; i++) {
- if (i + ScrollY >= buffer.UnfoldedLines)//TODO:need optimize
+ if (i + ScrollY >= unfoldedLines)//TODO:need optimize
break;
drawLine (gr, cb, i);
}
</MenuItem>
<MenuItem Caption="View" Fit="true" PopWidth="150">
<MenuItem Command="{CMDViewSolution}"/>
+ <MenuItem Command="{CMDViewEditor}"/>
+ <MenuItem Command="{CMDViewProperties}"/>
<MenuItem Command="{CMDViewErrors}"/>
<MenuItem Command="{CMDViewGTExp}"/>
<MenuItem Command="{CMDViewProps}"/>
</MenuItem>
</Menu>
<Docker Name="mainDock">
- <DockWindow DataSource="{CurrentSolution}" Name="winEditor" Caption="Edit View" Width="70%" Height="80%">
+ <DockStack />
+<!-- <DockWindow DataSource="{CurrentSolution}" Name="winEditor" Caption="Edit View" Width="70%" Height="80%">
<Template>
<Border BorderWidth="1" Foreground="Jet" CornerRadius="{./CornerRadius}"
Background="{./Background}"
</Template>
<EditPane SelectedItem="{²SelectedItem}" SelectedItemElement="{²SelectedItemElement}" Data="{OpenedItems}" DataTest="Extension"
ItemTemplate="#Crow.Coding.ui.EditPaneItems.template"/>
- </DockWindow>
+ </DockWindow>-->
</Docker>
</VerticalStack>
</Window>
--- /dev/null
+<?xml version="1.0"?>
+<DockWindow DataSource="{CurrentSolution}" Name="winProperties" Caption="Properties" Width="30%" Height="80%">
+ <MembersView ProjectNode="{SelectedItem}"
+ Instance="{SelectedItemElement}" DataTest="Type"
+ ItemTemplate="#Crow.Coding.ui.MembersItem.template"/>
+</DockWindow>
+
<?xml version="1.0"?>
<DockWindow DataSource="{CurrentSolution}" Name="winSolution" Caption="Solution" Width="30%" Height="80%">
- <VerticalStack>
- <TreeView Name="treeview" IsRoot="true" Height="50%"
- Data="{Projects}" SelectedItemChanged="onSelectedItemChanged"
- ItemTemplate="#Crow.Coding.ui.ProjectTree.template"/>
- <Splitter/>
- <MembersView ProjectNode="{SelectedItem}"
- Instance="{SelectedItemElement}" DataTest="Type"
- ItemTemplate="#Crow.Coding.ui.MembersItem.template"/>
- </VerticalStack>
+ <TreeView Name="treeview" IsRoot="true"
+ Data="{Projects}" SelectedItemChanged="onSelectedItemChanged"
+ ItemTemplate="#Crow.Coding.ui.ProjectTree.template"/>
</DockWindow>
<?xml version="1.0"?>
<!--<GraphicObject Background="{./Background}"/>-->
-<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
+<Border BorderWidth="1" Foreground="Black" CornerRadius="{./CornerRadius}"
Background="{./Background}"
MouseEnter="./onBorderMouseEnter"
MouseLeave="./onBorderMouseLeave">
<VerticalStack Spacing="0">
+ <Label Visible="{./IsDocked}" Width="Stretched" Foreground="White" Margin="0" TextAlignment="Left" Text="{./Caption}" />
<HorizontalStack Background="vgradient|0:0.5,0.6,0.5,0.5|1:0.2,0.3,0.3,0.7"
- Name="hs" Margin="0" Spacing="0" Height="Fit">
+ Name="hs" Margin="0" Spacing="0" Height="Fit" Visible="{./IsFloating}">
<GraphicObject Width="5"/>
<Image Margin="1" Width="10" Height="10" Path="{./Icon}"/>
- <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" />
+ <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Left" Text="{./Caption}" />
<Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="10" Width="10"
MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
+using System.Xml.Serialization;
namespace Crow
{
return;
isDocked = value;
NotifyValueChanged ("IsDocked", isDocked);
+ NotifyValueChanged ("IsFloating", !isDocked);
}
}
+ [XmlIgnore] public bool IsFloating { get { return !isDocked; }}
+
public Alignment DockingPosition {
get { return docking; }
set {
protected override void onDrop (object sender, DragDropEventArgs e)
{
if (!isDocked && DockingPosition != Alignment.Undefined)
- dock (e.DropTarget as DockStack);
+ Dock (e.DropTarget as DockStack);
base.onDrop (sender, e);
}
public void Undock () {
}
}
- void dock (DockStack target){
+ public void Dock (DockStack target){
lock (IFace.UpdateMutex) {
IsDocked = true;
//undockingMousePosOrig = lastMousePos;