summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-12 16:25:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-12 16:25:34 +0000
commit7fcc33b6f02d4d36c1e45051200921dbd9ec4e9e (patch)
treea25ed098acf04efcf93d9e6fb4d5d0bb5703cc38 /plugins/Scriver
parent4da1ba7e23b975db9694b836b89b067ddb90bc02 (diff)
Yandex added to Scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@3987 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/res/resource.rc5
-rw-r--r--plugins/Scriver/res/yandex.icobin0 -> 1150 bytes
-rw-r--r--plugins/Scriver/src/chat/window.cpp1
-rw-r--r--plugins/Scriver/src/globals.cpp4
-rw-r--r--plugins/Scriver/src/msgdialog.cpp1
-rw-r--r--plugins/Scriver/src/resource.h31
-rw-r--r--plugins/Scriver/src/utils.cpp86
-rw-r--r--plugins/Scriver/src/utils.h11
8 files changed, 70 insertions, 69 deletions
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc
index 62d332ea6a..df3734cf73 100644
--- a/plugins/Scriver/res/resource.rc
+++ b/plugins/Scriver/res/resource.rc
@@ -569,10 +569,11 @@ IDI_FILTER2 ICON "chat/filter2.ico"
IDI_GOOGLE ICON "google.ico"
IDI_BING ICON "bing.ico"
+IDI_YANDEX ICON "yandex.ico"
IDI_WIKIPEDIA ICON "wikipedia.ico"
IDI_GOOGLE_MAPS ICON "gmaps.ico"
IDI_GOOGLE_TRANSLATE ICON "gtranslate.ico"
-IDI_YAHOO ICON "yahoo.ico"
+IDI_YAHOO ICON "yahoo.ico"
IDI_FOODNETWORK ICON "foodnetwork.ico"
@@ -602,6 +603,7 @@ BEGIN
BEGIN
MENUITEM "Google", IDM_SEARCH_GOOGLE
MENUITEM "Bing", IDM_SEARCH_BING
+ MENUITEM "Yandex", IDM_SEARCH_YANDEX
MENUITEM "Wikipedia (en)", IDM_SEARCH_WIKIPEDIA
MENUITEM SEPARATOR
MENUITEM "Google Maps", IDM_SEARCH_GOOGLE_MAPS
@@ -657,6 +659,7 @@ BEGIN
BEGIN
MENUITEM "Google", IDM_SEARCH_GOOGLE
MENUITEM "Bing", IDM_SEARCH_BING
+ MENUITEM "Yandex", IDM_SEARCH_YANDEX
MENUITEM "Wikipedia (en)", IDM_SEARCH_WIKIPEDIA
MENUITEM SEPARATOR
MENUITEM "Google Maps", IDM_SEARCH_GOOGLE_MAPS
diff --git a/plugins/Scriver/res/yandex.ico b/plugins/Scriver/res/yandex.ico
new file mode 100644
index 0000000000..654639c879
--- /dev/null
+++ b/plugins/Scriver/res/yandex.ico
Binary files differ
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 50716c13f6..e0e1bd68b5 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -754,6 +754,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case IDM_SEARCH_GOOGLE:
case IDM_SEARCH_BING:
+ case IDM_SEARCH_YANDEX:
case IDM_SEARCH_YAHOO:
case IDM_SEARCH_WIKIPEDIA:
case IDM_SEARCH_FOODNETWORK:
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 36e0be464a..1d4c12fb06 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -199,8 +199,8 @@ void LoadGlobalIcons() {
ImageList_AddIcon(g_dat->hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
overlayIcon = ImageList_AddIcon(g_dat->hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
ImageList_SetOverlayImage(g_dat->hHelperIconList, overlayIcon, 1);
- for (i=0; i<IDI_FOODNETWORK - IDI_GOOGLE + 1; i++) {
- HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_GOOGLE + i), IMAGE_ICON, 0, 0, 0);
+ for (i=IDI_GOOGLE; i < IDI_LASTICON; i++) {
+ HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(i), IMAGE_ICON, 0, 0, 0);
ImageList_AddIcon(g_dat->hSearchEngineIconList, hIcon);
DestroyIcon(hIcon);
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 1daa25b359..5c6f2156af 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -378,6 +378,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case IDM_SEARCH_GOOGLE:
case IDM_SEARCH_BING:
+ case IDM_SEARCH_YANDEX:
case IDM_SEARCH_YAHOO:
case IDM_SEARCH_WIKIPEDIA:
case IDM_SEARCH_FOODNETWORK:
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h
index 6f48c2d97a..bfe2a0a7ac 100644
--- a/plugins/Scriver/src/resource.h
+++ b/plugins/Scriver/src/resource.h
@@ -17,7 +17,7 @@
#define IDI_UNICODEON 127
#define IDI_UNICODEOFF 128
#define IDI_TIMESTAMP 129
-#define IDI_QUOTE 130
+#define IDI_QUOTE 130
#define IDI_INCOMING 132
#define IDI_OUTGOING 133
#define IDI_NOTICE 134
@@ -25,11 +25,13 @@
#define IDI_GOOGLE 140
#define IDI_BING 141
-#define IDI_WIKIPEDIA 142
-#define IDI_GOOGLE_MAPS 143
-#define IDI_GOOGLE_TRANSLATE 144
-#define IDI_YAHOO 145
-#define IDI_FOODNETWORK 146
+#define IDI_YANDEX 142
+#define IDI_WIKIPEDIA 143
+#define IDI_GOOGLE_MAPS 144
+#define IDI_GOOGLE_TRANSLATE 145
+#define IDI_YAHOO 146
+#define IDI_FOODNETWORK 147
+#define IDI_LASTICON 148
#define IDR_CONTEXT 180
@@ -187,16 +189,17 @@
#define IDM_CLEAR 40013
#define IDM_OPENLINK 40014
#define IDM_COPYLINK 40016
-#define IDM_CLOSETAB 40020
-#define IDM_CLOSEOTHERTABS 40021
-#define IDM_TOPMOST 40040
+#define IDM_CLOSETAB 40020
+#define IDM_CLOSEOTHERTABS 40021
+#define IDM_TOPMOST 40040
#define IDM_SEARCH_GOOGLE 40080
#define IDM_SEARCH_BING 40081
-#define IDM_SEARCH_WIKIPEDIA 40082
-#define IDM_SEARCH_GOOGLE_MAPS 40083
-#define IDM_SEARCH_GOOGLE_TRANSLATE 40084
-#define IDM_SEARCH_YAHOO 40085
-#define IDM_SEARCH_FOODNETWORK 40086
+#define IDM_SEARCH_YANDEX 40082
+#define IDM_SEARCH_WIKIPEDIA 40083
+#define IDM_SEARCH_GOOGLE_MAPS 40084
+#define IDM_SEARCH_GOOGLE_TRANSLATE 40085
+#define IDM_SEARCH_YAHOO 40086
+#define IDM_SEARCH_FOODNETWORK 40087
/* chat.dll resources */
#define IDC_CHAT_LOG 5005
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index 8a69febd79..8822bf47f5 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -483,47 +483,45 @@ void SearchWord(TCHAR * word, int engine)
//char *wordURL = (char *)CallService(MS_NETLIB_URLENCODE, 0, (LPARAM)wordUTF);
char *wordURL = url_encode(wordUTF);
switch (engine) {
- case SEARCHENGINE_WIKIPEDIA:
- mir_snprintf( szURL, sizeof( szURL ), "http://en.wikipedia.org/wiki/%s", wordURL );
- break;
- case SEARCHENGINE_YAHOO:
- mir_snprintf( szURL, sizeof( szURL ), "http://search.yahoo.com/search?p=%s&ei=UTF-8", wordURL );
- break;
- case SEARCHENGINE_FOODNETWORK:
- mir_snprintf( szURL, sizeof( szURL ), "http://search.foodnetwork.com/search/delegate.do?fnSearchString=%s", wordURL );
- break;
- case SEARCHENGINE_BING:
- mir_snprintf( szURL, sizeof( szURL ), "http://www.bing.com/search?q=%s&form=OSDSRC", wordURL );
- break;
- case SEARCHENGINE_GOOGLE_MAPS:
- mir_snprintf( szURL, sizeof( szURL ), "http://maps.google.com/maps?q=%s&ie=utf-8&oe=utf-8", wordURL );
- break;
- case SEARCHENGINE_GOOGLE_TRANSLATE:
- mir_snprintf( szURL, sizeof( szURL ), "http://translate.google.com/?q=%s&ie=utf-8&oe=utf-8", wordURL );
- break;
- case SEARCHENGINE_GOOGLE:
- default:
- mir_snprintf( szURL, sizeof( szURL ), "http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8", wordURL );
- break;
+ case SEARCHENGINE_WIKIPEDIA:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://en.wikipedia.org/wiki/%s", wordURL);
+ break;
+ case SEARCHENGINE_YAHOO:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://search.yahoo.com/search?p=%s&ei=UTF-8", wordURL);
+ break;
+ case SEARCHENGINE_FOODNETWORK:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://search.foodnetwork.com/search/delegate.do?fnSearchString=%s", wordURL);
+ break;
+ case SEARCHENGINE_BING:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://www.bing.com/search?q=%s&form=OSDSRC", wordURL);
+ break;
+ case SEARCHENGINE_GOOGLE_MAPS:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://maps.google.com/maps?q=%s&ie=utf-8&oe=utf-8", wordURL);
+ break;
+ case SEARCHENGINE_GOOGLE_TRANSLATE:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://translate.google.com/?q=%s&ie=utf-8&oe=utf-8", wordURL);
+ break;
+ case SEARCHENGINE_YANDEX:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://yandex.ru/yandsearch?text=%s", wordURL);
+ break;
+ case SEARCHENGINE_GOOGLE:
+ default:
+ mir_snprintf(szURL, SIZEOF(szURL), "http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8", wordURL);
+ break;
}
-// HeapFree(GetProcessHeap(), 0, wordURL);
+
mir_free(wordUTF);
mir_free(wordURL);
CallService(MS_UTILS_OPENURL, 1, (LPARAM) szURL);
}
}
-void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList) {
- int i;
- for (i=0; i<IDI_FOODNETWORK - IDI_GOOGLE + 1; i++) {
- MENUITEMINFO minfo = {0};
- minfo.cbSize = sizeof(minfo);
-// minfo.fMask = MIIM_FTYPE | MIIM_ID;
-// GetMenuItemInfo(hMenu, IDM_SEARCH_GOOGLE + i, FALSE, &minfo);
+void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList)
+{
+ for (int i=0; i < IDI_LASTICON - IDI_GOOGLE; i++) {
+ MENUITEMINFO minfo = { sizeof(minfo) };
minfo.fMask = MIIM_BITMAP | MIIM_DATA;
minfo.hbmpItem = HBMMENU_CALLBACK;
- //minfo.fType = MFT_STRING;
- //minfo.wID = IDM_SEARCH_GOOGLE + i;
minfo.dwItemData = (ULONG_PTR) hImageList;
SetMenuItemInfo(hMenu, IDM_SEARCH_GOOGLE + i, FALSE, &minfo);
}
@@ -618,31 +616,25 @@ HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cC
void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton* buttons, int controlVisibility, int state)
{
- int i;
- for (i = 0; i < cControls; i++)
+ for (int i = 0; i < cControls; i++)
ShowWindow(GetDlgItem(hwndDlg, buttons[i].controlId), (controlVisibility & (1 << i)) ? state : SW_HIDE);
}
int GetToolbarWidth(int cControls, const ToolbarButton * buttons)
{
- int i, w = 0;
- for (i = 0; i < cControls; i++) {
-// if (g_dat->buttonVisibility & (1 << i)) {
- if (buttons[i].controlId != IDC_SMILEYS || g_dat->smileyAddInstalled) {
- w += buttons[i].width + buttons[i].spacing;
- }
-// }
- }
+ int w = 0;
+ for (int i = 0; i < cControls; i++)
+ if (buttons[i].controlId != IDC_SMILEYS || g_dat->smileyAddInstalled)
+ w += buttons[i].width + buttons[i].spacing;
+
return w;
}
BOOL IsToolbarVisible(int cControls, int visibilityFlags)
{
- int i;
- for (i = 0; i < cControls; i++) {
- if (visibilityFlags & (1 << i)) {
+ for (int i = 0; i < cControls; i++)
+ if (visibilityFlags & (1 << i))
return TRUE;
- }
- }
+
return FALSE;
}
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h
index 0d3b3ab4e1..5a51e87099 100644
--- a/plugins/Scriver/src/utils.h
+++ b/plugins/Scriver/src/utils.h
@@ -26,11 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
enum SEARCHENGINES {
SEARCHENGINE_GOOGLE = 1,
SEARCHENGINE_BING = 2,
- SEARCHENGINE_WIKIPEDIA = 3,
- SEARCHENGINE_GOOGLE_MAPS = 4,
- SEARCHENGINE_GOOGLE_TRANSLATE = 5,
- SEARCHENGINE_YAHOO = 6,
- SEARCHENGINE_FOODNETWORK=7
+ SEARCHENGINE_YANDEX = 3,
+ SEARCHENGINE_WIKIPEDIA = 4,
+ SEARCHENGINE_GOOGLE_MAPS = 5,
+ SEARCHENGINE_GOOGLE_TRANSLATE = 6,
+ SEARCHENGINE_YAHOO = 7,
+ SEARCHENGINE_FOODNETWORK = 8
};
HANDLE HookEvent_Ex(const char *name, MIRANDAHOOK hook);