本文整理汇总了C++中FV_View::moveInsPtTo方法的典型用法代码示例。如果您正苦于以下问题:C++ FV_View::moveInsPtTo方法的具体用法?C++ FV_View::moveInsPtTo怎么用?C++ FV_View::moveInsPtTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FV_View
的用法示例。
在下文中一共展示了FV_View::moveInsPtTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: url
//
// URLDict_invoke
// -------------------
// This is the function that we actually call to invoke the on-line dictionary.
// It should be called when the user selects from the context menu
//
static bool
URLDict_invoke(AV_View* /*v*/, EV_EditMethodCallData * /*d*/)
{
// Get the current view that the user is in.
XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView());
// If the user is on a word, but does not have it selected, we need
// to go ahead and select that word so that the search/replace goes
// correctly.
pView->moveInsPtTo(FV_DOCPOS_EOW_MOVE);
pView->moveInsPtTo(FV_DOCPOS_BOW);
pView->extSelTo(FV_DOCPOS_EOW_SELECT);
// Now we will figure out what word to look up when we open our dialog.
UT_String url ("http://www.dict.org/bin/Dict?Form=Dict1&Database=*&Strategy=*&Query=");
if (!pView->isSelectionEmpty())
{
// We need to get the Ascii version of the current word.
UT_UCS4Char *ucs4ST;
pView->getSelectionText(*&ucs4ST);
char* search = _ucsToAscii(
ucs4ST
);
url += search;
DELETEPV(search);
FREEP(ucs4ST);
}
XAP_App::getApp()->openURL( url.c_str() );
return true;
}
示例2: search
//
// GDict_invoke
// -------------------
// This is the function that we actually call to invoke the thesaurus.
// It should be called when the user hits the thesaurus key (shift+f7?)
// or chooses "thesaurus" from a menu.
//
static bool
GDict_invoke(AV_View* /*v*/, EV_EditMethodCallData */*d*/)
{
// Get the current view that the user is in.
XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView());
// If the user is on a word, but does not have it selected, we need
// to go ahead and select that word so that the search/replace goes
// correctly.
pView->moveInsPtTo(FV_DOCPOS_EOW_MOVE);
pView->moveInsPtTo(FV_DOCPOS_BOW);
pView->extSelTo(FV_DOCPOS_EOW_SELECT);
// We need to get the utf-8 version of the current word.
UT_UCS4Char *ucs4ST = NULL;
pView->getSelectionText(*&ucs4ST);
if (ucs4ST) {
UT_UTF8String search(ucs4ST);
GDict_exec (search.utf8_str());
FREEP(ucs4ST);
}
return true;
}
示例3: url
//
// AbiGoogle_invoke
// -------------------
// This is the function that we actually call to invoke the on-line dictionary.
// It should be called when the user selects from the context menu
//
static bool
AbiGoogle_invoke(AV_View* /*v*/, EV_EditMethodCallData * /*d*/)
{
// Get the current view that the user is in.
XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView());
// If the user is on a word, but does not have it selected, we need
// to go ahead and select that word so that the search/replace goes
// correctly.
if (pView->isSelectionEmpty()) {
pView->moveInsPtTo(FV_DOCPOS_EOW_MOVE);
pView->moveInsPtTo(FV_DOCPOS_BOW);
pView->extSelTo(FV_DOCPOS_EOW_SELECT);
}
// Now we will figure out what word to look up
UT_UTF8String url ("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=");
// url escaping should be moved somewhere more generic
UT_UCS4Char *ucs4ST;
pView->getSelectionText(*&ucs4ST);
UT_UCS4String data (ucs4ST);
bool last_was_space = false;
for (size_t i = 0; i < data.length (); i++) {
UT_UCS4Char ch = data[i];
if (!UT_UCS4_isspace (ch)) {
url.appendUCS4 (&ch, 1);
last_was_space = false;
}
else if (!last_was_space) {
ch = '+';
url.appendUCS4 (&ch, 1);
last_was_space = true;
}
}
XAP_App::getApp()->openURL( url.utf8_str() );
FREEP(ucs4ST);
return true;
}
示例4:
//
// AiksaurusABI_invoke
// -------------------
// This is the function that we actually call to invoke the thesaurus.
// It should be called when the user hits the thesaurus key (shift+f7?)
// or chooses "thesaurus" from a menu.
//
bool
AiksaurusABI_invoke(AV_View* /*v*/, EV_EditMethodCallData * /*d*/)
{
// Get the current view that the user is in.
XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
FV_View* pView = static_cast<FV_View*>(pFrame->getCurrentView());
// If the user is on a word, but does not have it selected, we need
// to go ahead and select that word so that the search/replace goes
// correctly.
pView->moveInsPtTo(FV_DOCPOS_EOW_MOVE);
pView->moveInsPtTo(FV_DOCPOS_BOW);
pView->extSelTo(FV_DOCPOS_EOW_SELECT);
// Now we will figure out what word to look up when we open our dialog.
char* search = 0;
if (!pView->isSelectionEmpty())
{
// We need to get the Ascii version of the current word.
UT_UCS4Char * ucs4ST;
pView->getSelectionText(*&ucs4ST);
search = AiksaurusABI_ucsToAscii(
ucs4ST
);
}
// Now we will run the thesaurus dialog and get a response.
// We will automatically do a search for the selected/current word.
#ifdef _WIN32
AiksaurusApp thesaurus;
thesaurus.setInstance( (HINSTANCE)s_hModule );
#else
AiksaurusGTK thesaurus;
#endif
thesaurus.setTitle("Abiword Thesaurus");
thesaurus.setInitialMessage("Welcome to Aiksaurus");
const char* response = thesaurus.runThesaurus(search);
if (response)
{
// Now that we have our replacement, we need to convert it to UCS-2.
int length;
UT_UCSChar* replacement = AiksaurusABI_asciiToUcs(response, length);
// Now, if our replacement has length, we can go ahead and run the
// replacement. If the replacement has no length, we will do nothing.
if (length)
pView->cmdCharInsert(replacement, length);
// all done with replacement.
delete[] replacement;
}
// Finally, we need to remember to delete search and replacement strings.
// Note that "search" might be null so we only want to delete[] it if it
// was actually initialized above.
if (search)
delete[] search;
return true;
}