]> O.S.I.I.S - jp/crow.git/commitdiff
update crowIDE
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 4 Aug 2019 09:11:47 +0000 (11:11 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 4 Aug 2019 09:11:47 +0000 (11:11 +0200)
Crow.sln
Crow/src/GraphicObjects/Label.cs
Crow/src/GraphicObjects/TextRun.cs

index a729dd56bfbd5d8a94a0f8d49d74f5173e331c89..37f1d7b111dd608be69409548c3f8376c468c760 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "Samples\Hello
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowCase", "Samples\ShowCase\ShowCase.csproj", "{56329D48-D382-4850-93DE-59C453894E8A}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{C40A3F21-0558-4265-9251-718C1564D10A}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
                {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.Build.0 = Release|Any CPU
                {56329D48-D382-4850-93DE-59C453894E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {C40A3F21-0558-4265-9251-718C1564D10A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {C40A3F21-0558-4265-9251-718C1564D10A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {C40A3F21-0558-4265-9251-718C1564D10A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {C40A3F21-0558-4265-9251-718C1564D10A}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(MonoDevelopProperties) = preSolution
                Policies = $0
@@ -69,6 +75,6 @@ Global
        EndGlobalSection
        GlobalSection(NestedProjects) = preSolution
                {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}
-               {56329D48-D382-4850-93DE-59C453894E8A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}         
+               {56329D48-D382-4850-93DE-59C453894E8A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}
        EndGlobalSection
 EndGlobal
index b4b813c6b5b4cbaab804cdf1665ddab4c897515c..c7bd5124fb586168aa5325604d7b944248468d6d 100644 (file)
@@ -447,37 +447,34 @@ namespace Crow
                        if (lines == null)
                                lines = getLines;
                        if (!textMeasureIsUpToDate) {
-                               using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {
-                                       using (Context gr = new Context (img)) {
-                                               //Cairo.FontFace cf = gr.GetContextFontFace ();
-
-                                               gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
-                                               gr.SetFontSize (Font.Size);
-                                               gr.FontOptions = Interface.FontRenderingOptions;
-                                               gr.Antialias = Interface.Antialias;
-
-                                               fe = gr.FontExtents;
-                                               te = new TextExtents ();
-
-                                               cachedTextSize.Height = (int)Math.Ceiling ((fe.Ascent+fe.Descent) * Math.Max (1, lines.Count)) + Margin * 2;
-
-                                               try {
-                                                       for (int i = 0; i < lines.Count; i++) {
-                                                               string l = lines[i].Replace ("\t", new String (' ', Interface.TabSize));
-
-                                                               TextExtents tmp = gr.TextExtents (l);
-
-                                                               if (tmp.XAdvance > te.XAdvance)
-                                                                       te = tmp;
-                                                       }
-                                                       cachedTextSize.Width = (int)Math.Ceiling (te.XAdvance) + Margin * 2;
-                                                       textMeasureIsUpToDate = true;
-                                               } catch {                                                       
-                                                       return -1;
-                                               }                                       
-                                       }
-                               }
+                               using (Context gr = new Context (IFace.surf)) {
+                                       //Cairo.FontFace cf = gr.GetContextFontFace ();
+
+                                       gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+                                       gr.SetFontSize (Font.Size);
+                                       gr.FontOptions = Interface.FontRenderingOptions;
+                                       gr.Antialias = Interface.Antialias;
+
+                                       fe = gr.FontExtents;
+                                       te = new TextExtents ();
+
+                                       cachedTextSize.Height = (int)Math.Ceiling ((fe.Ascent+fe.Descent) * Math.Max (1, lines.Count)) + Margin * 2;
 
+                                       try {
+                                               for (int i = 0; i < lines.Count; i++) {
+                                                       string l = lines[i].Replace ("\t", new String (' ', Interface.TabSize));
+
+                                                       TextExtents tmp = gr.TextExtents (l);
+
+                                                       if (tmp.XAdvance > te.XAdvance)
+                                                               te = tmp;
+                                               }
+                                               cachedTextSize.Width = (int)Math.Ceiling (te.XAdvance) + Margin * 2;
+                                               textMeasureIsUpToDate = true;
+                                       } catch {                                                       
+                                               return -1;
+                                       }                                       
+                               }
                        }
                        return lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width;
                }
index 2be1d628e959bf80b363e4ebccc901cc346202e7..48687176724f430027d5d1c73e9787a219bf3592 100644 (file)
@@ -149,35 +149,33 @@ namespace Crow
                {
                        if (lines == null)
                                lines = getLines;
+                               
+                       using (Context gr = new Context (IFace.surf)) {
+                               //Cairo.FontFace cf = gr.GetContextFontFace ();
 
-                       using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {
-                               using (Context gr = new Context (img)) {
-                                       //Cairo.FontFace cf = gr.GetContextFontFace ();
+                               gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
+                               gr.SetFontSize (Font.Size);
 
-                                       gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
-                                       gr.SetFontSize (Font.Size);
 
+                               fe = gr.FontExtents;
+                               te = new TextExtents ();
 
-                                       fe = gr.FontExtents;
-                                       te = new TextExtents ();
+                               if (lt == LayoutingType.Height) {
+                                       int lc = lines.Count;
+                                       //ensure minimal height = text line height
+                                       if (lc == 0)
+                                               lc = 1;
 
-                                       if (lt == LayoutingType.Height) {
-                                               int lc = lines.Count;
-                                               //ensure minimal height = text line height
-                                               if (lc == 0)
-                                                       lc = 1;
-
-                                               return (int)(fe.Height * lc) + Margin * 2;
-                                       }
+                                       return (int)(fe.Height * lc) + Margin * 2;
+                               }
 
-                                       foreach (string s in lines) {
-                                               string l = s.Replace("\t", new String (' ', Interface.TabSize));
-                                               TextExtents tmp = gr.TextExtents (l);
-                                               if (tmp.XAdvance > te.XAdvance)
-                                                       te = tmp;
-                                       }
-                                       return (int)Math.Ceiling (te.XAdvance) + Margin * 2;
+                               foreach (string s in lines) {
+                                       string l = s.Replace("\t", new String (' ', Interface.TabSize));
+                                       TextExtents tmp = gr.TextExtents (l);
+                                       if (tmp.XAdvance > te.XAdvance)
+                                               te = tmp;
                                }
+                               return (int)Math.Ceiling (te.XAdvance) + Margin * 2;
                        }
                }
                protected override void onDraw (Context gr)