From eba30bb9b2dffa95a1b20c9ed6e9a4e21acfd2e2 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 23 Apr 2014 07:54:27 +0000 Subject: [PATCH] ide: Insert file path as C string #738 git-svn-id: svn://ultimatepp.org/upp/trunk@7306 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Insert.cpp | 10 +++++++--- uppsrc/ide/ide.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/uppsrc/ide/Insert.cpp b/uppsrc/ide/Insert.cpp index d81af263f..67439fec9 100644 --- a/uppsrc/ide/Insert.cpp +++ b/uppsrc/ide/Insert.cpp @@ -97,12 +97,15 @@ void Ide::InsertCString() editor.Paste(AsCString(txt).ToWString()); } -void Ide::InsertFilePath() +void Ide::InsertFilePath(bool c) { String path = SelectFileOpen("All files\t*.*"); path.Replace("\\", "/"); - if(path.GetCount()) + if(path.GetCount()) { + if(c) + path = AsCString(path); editor.Paste(path.ToWString()); + } } void Ide::InsertMenu(Bar& bar) @@ -148,7 +151,8 @@ void Ide::InsertMenu(Bar& bar) } } bar.Add("Insert clipboard as C string", THISBACK(InsertCString)); - bar.Add("Insert file path..", THISBACK(InsertFilePath)); + bar.Add("Insert file path..", THISBACK1(InsertFilePath, false)); + bar.Add("Insert file path as C string..", THISBACK1(InsertFilePath, true)); } void Ide::InsertAdvanced(Bar& bar) diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index 9f7d8c856..fa99317d7 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -848,7 +848,7 @@ public: void InsertIml(const String& fn, String classname); void InsertText(const String& text); void InsertCString(); - void InsertFilePath(); + void InsertFilePath(bool c); void InsertMenu(Bar& bar); void InsertAdvanced(Bar& bar); void EditorMenu(Bar& bar);