OSDN Git Service

読み込み時に行分割を行わず、レタリング時に行分割を行うようにした
[fooeditengine/FooEditEngine.git] / Core / TextServiceFramework / TextStoreHelper.cs
index f043f07..f6508f2 100644 (file)
@@ -8,11 +8,14 @@
 
 You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
+#if METRO || WPF || WINDOWS_UWP
+
+ using System.Linq;
 #if METRO || WPF
-using System.Linq;
 using DotNetTextStore.UnmanagedAPI.WinDef;
 using DotNetTextStore.UnmanagedAPI.TSF;
 using DotNetTextStore;
+#endif
 
 namespace FooEditEngine
 {
@@ -29,6 +32,7 @@ namespace FooEditEngine
             document.UndoManager.EndUndoGroup();
         }
 
+#if METRO || WPF
         public static bool ScrollToCompstionUpdated(TextStoreBase textStore,EditView view,int start, int end)
         {
             if (textStore.IsLocked() == false)
@@ -48,6 +52,7 @@ namespace FooEditEngine
             }
             return false;   
         }
+#endif
 
         public static void GetStringExtent(Document document,EditView view,int i_startIndex,int i_endIndex,out Point startPos,out Point endPos)
         {
@@ -57,25 +62,25 @@ namespace FooEditEngine
             startPos = view.GetPostionFromTextPoint(view.LayoutLines.GetTextPointFromIndex(i_startIndex));
             endTextPoint = view.GetLayoutLineFromIndex(endIndex);
             endPos = view.GetPostionFromTextPoint(endTextPoint);
-            //変換候補リストに隙間があるので、ユーザーが見えるように少し移動させる
-            endPos.Y += view.LayoutLines.GetLayout(endTextPoint.row).Height + 15;
+            //アンダーラインを描くことがあるので少しずらす
+            endPos.Y += view.render.emSize.Height + 5;
         }
 
-        public static void GetSelection(Controller controller, SelectCollection selectons, out int o_startIndex, out int o_endIndex)
+        public static void GetSelection(Controller controller, SelectCollection selectons, out TextRange sel)
         {
             if (controller.RectSelection && selectons.Count > 0)
             {
-                o_startIndex = selectons[0].start;
-                o_endIndex = o_startIndex + selectons[0].length;
+                sel.Index = selectons[0].start;
+                sel.Length = 0;
             }
             else
             {
-                o_startIndex = controller.SelectionStart;
-                o_endIndex = o_startIndex + controller.SelectionLength;
+                sel.Index = controller.SelectionStart;
+                sel.Length = controller.SelectionLength;
             }
         }
 
-        public static void SetSelectionIndex(Controller controller,EditView view,int i_startIndex, int i_endIndex)
+        public static void SetSelectionIndex(Controller controller,EditView view,int i_startIndex,int i_endIndex)
         {
             if (controller.IsRectInsertMode())
             {
@@ -94,11 +99,12 @@ namespace FooEditEngine
             }
         }
 
-        public static void InsertTextAtSelection(Controller controller,string i_value)
+        public static void InsertTextAtSelection(Controller controller,string i_value, bool fromTIP = true)
         {
-            controller.DoInputString(i_value, true);
+            controller.DoInputString(i_value, fromTIP);
         }
 
+#if METRO || WPF
         public static void NotifyTextChanged(TextStoreBase textStore, int startIndex,int removeLength,int insertLength)
         {
 #if METRO
@@ -114,6 +120,7 @@ namespace FooEditEngine
 #endif
             textStore.NotifyTextChanged(startIndex, oldend, newend);
         }
+#endif
     }
 }
 #endif